首页 > 代码库 > ACM学习历程—HDU4969 Just a Joke(物理题)
ACM学习历程—HDU4969 Just a Joke(物理题)
Just a Joke
Description
Here is just a joke, and do not take it too seriously.
Guizeyanhua is the president of ACMM, and people call him President Guizeyanhua. When Guizeyanhua is walking on the road, everyone eyes on him with admiration. Recently, Guizeyanhua has fallen in love with an unknown girl who runs along the circular race track on the playground every evening. One evening, Guizeyanhua stood in the center of the circular race track and stared the girl soulfully again. But this time he decided to catch up with the girl because of his lovesickness. He rushed to the girl and intended to show her his love heart. However, he could not run too far since he had taken an arrow in the knee.
Now your task is coming. Given the maximum distance Guizeyanhua can run, you are asked to check whether he can catch up with the girl. Assume that the values of Guizeyanhua‘s and the girl‘s velocity are both constants, and Guizeyanhua, the girl, and the center of the circular race track always form a straight line during the process. Note that the girl and Guizeyanhua can be considered as two points.
其中轨迹圆相切于起始直线,也就是说轨迹圆的圆心在y轴上。
接下来证明:
采用物理中的微元法:
假设在某位置,经过dt时间,dt非常小,接近于0
位置变化如图。
由于dt很小,所以a角度接近于0。于是包含a角的直角三角形近似接近于一块扇形。于是扇形弧长为ra。然后由dr,ra,v2dt构成的直角三角形得到如下式子:
然后两边同除以dt得:
即:
其中w为角速度,v为径向速度。(当然,用速度分解能更快得出这个结论)
由v1可得角速度
w=v1/R
于是就是一个求解r的微分方程了。(v=dr/dt)
但是发现这个微分方程求解的时候如果换元,换元的时候是令
化简出来如果k=w,那么是个恒等式。
说明是恒成立的。
然后由图中关系便可得轨迹。
不过这个题目不需要求轨迹方程,不过如果知道结论当然更好。这样以后推导中间的几何关系便可得出判断的式子
最后得出的结论是如果arcsin(v1v2)<=(v1/v2)*(D/R)那么能追上。 View Code
Guizeyanhua is the president of ACMM, and people call him President Guizeyanhua. When Guizeyanhua is walking on the road, everyone eyes on him with admiration. Recently, Guizeyanhua has fallen in love with an unknown girl who runs along the circular race track on the playground every evening. One evening, Guizeyanhua stood in the center of the circular race track and stared the girl soulfully again. But this time he decided to catch up with the girl because of his lovesickness. He rushed to the girl and intended to show her his love heart. However, he could not run too far since he had taken an arrow in the knee.
Now your task is coming. Given the maximum distance Guizeyanhua can run, you are asked to check whether he can catch up with the girl. Assume that the values of Guizeyanhua‘s and the girl‘s velocity are both constants, and Guizeyanhua, the girl, and the center of the circular race track always form a straight line during the process. Note that the girl and Guizeyanhua can be considered as two points.
Input
The input begins with a line containing an integer T (T<=100000), which indicates the number of test cases. The following T lines each contain four integers V1, V2, R, and D (0<V1, V2, R, D<=10^9, V1<=V2). V1 is the velocity of the girl. V2 is the velocity of Guizeyanhua. R is the radius of the race track. D is the maximum distance President Guizeyanhua can run.
Output
For each case, output "Wake up to code" in a line if Guizeyanhua can catch up with the girl; otherwise output "Why give up treatment" in a line.
Sample Input
2
1 1 1 1
11904 41076 3561 3613
1 1 1 1
11904 41076 3561 3613
Sample Output
Why give up treatment
Wake up to code
这道题目是一道高中物理竞赛题,结论是运动轨迹是一个圆弧。如图:
Wake up to code
这道题目是一道高中物理竞赛题,结论是运动轨迹是一个圆弧。如图:
接下来证明:
采用物理中的微元法:
假设在某位置,经过dt时间,dt非常小,接近于0
位置变化如图。
由于dt很小,所以a角度接近于0。于是包含a角的直角三角形近似接近于一块扇形。于是扇形弧长为ra。然后由dr,ra,v2dt构成的直角三角形得到如下式子:
然后两边同除以dt得:
即:
其中w为角速度,v为径向速度。(当然,用速度分解能更快得出这个结论)
由v1可得角速度
w=v1/R
于是就是一个求解r的微分方程了。(v=dr/dt)
但是发现这个微分方程求解的时候如果换元,换元的时候是令
化简出来如果k=w,那么是个恒等式。
说明是恒成立的。
然后由图中关系便可得轨迹。
不过这个题目不需要求轨迹方程,不过如果知道结论当然更好。这样以后推导中间的几何关系便可得出判断的式子
最后得出的结论是如果arcsin(v1v2)<=(v1/v2)*(D/R)那么能追上。
代码:
1 #include <iostream> 2 #include <cstdio> 3 #include <cstdlib> 4 #include <cstring> 5 #include <cmath> 6 #include <algorithm> 7 #include <set> 8 #include <map> 9 #include <queue>10 #include <string>11 #include <vector>12 #define inf 0x3fffffff13 #define eps 1e-1014 15 using namespace std;16 17 long long v1, v2, r, d;18 double x, y;19 20 int main()21 {22 //freopen ("test.txt", "r", stdin);23 int T;24 scanf ("%d", &T);25 for (int times = 0; times < T; ++times)26 {27 scanf ("%I64d%I64d%I64d%I64d", &v1, &v2, &r, &d);28 x = (v1+0.0)/v2;29 y = (d+0.0)/r;30 y = x * y;31 x = asin(x);32 if (x > y)33 printf ("Why give up treatment\n");34 else35 printf ("Wake up to code\n");36 }37 return 0;38 }
ACM学习历程—HDU4969 Just a Joke(物理题)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。