题意:海上有地方发生爆炸,一个人与主船脱离,他想回到主船上去。爆炸的冲击波会使得主船沿着爆炸点到它的方向以V的速度远离,人有种装置确定主船位置,但是必须保证他到爆炸点的距离与船到爆炸点的距离一样,人的速度为2V,当前他们距离爆炸点的距离为D,人与船对于爆炸点的夹角为Θ,求人回到船的时间,如果大于10000,就输出"God help me!"。

题解:为了保证人和船时时刻刻与爆炸点距离相等,所以人的径向速度也应为V,那么切向速度就是√3V,在t时刻,他到爆炸点的距离为D+tV,于是在dt时间内,他旋转的角速度就是(√3V)/(D+tV),角度为(√3V)/(D+tV)*dt=dΘ,两边积分得

Θ+C=√3V*ln(D+tV),带入0时刻点的C=√3*ln(D),于是最后结果就是t=(e^(Θ/√3+ln(D))-D)/v

View Code
 1 #include<cstdio>
 2 #include<cstring>
 3 #include<cmath>
 4 using namespace std;
 5 const double pi=acos(-1.0),sq3=sqrt(3.0),eps=1e-8;
 6 int main()
 7 {
 8     double t,v,a,l;
 9     while(scanf("%lf%lf%lf",&v,&a,&l),v||a||l)
10     {
11         t=(exp(a/180.0*pi/sq3+log(l))-l)/v;
12         if(t>10000+eps)
13             printf("God help me!\n");
14         else
15             printf("%.0lf\n",t);
16     }
17     return 0;
18 }