和蚂蚁问题类似。
#include#include #include #include #include #include using namespace std;int c,n;double h,r,t,T;double ans[105];double cal(double time){ if(time<=0) return h; int f=0; while(1) { if(time<=T) { if(f==0) return h-0.5*10.0*time*time; return h-0.5*10.0*(T-time)*(T-time); } f=f^1; time=time-T; }}int main(){ scanf("%d",&c); while(c--) { scanf("%d%lf%lf%lf",&n,&h,&r,&t); T=sqrt(2*h/10.0); for(int i=0;i