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 cocould 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
Sample output
Why give up treatment
Wake up to code
This is a high school physical competition, and the conclusion is that the motion track is an arc.
The trajectory circle is tangent to the starting line, that is, the center of the trajectory circle is on the Y axis.
The following proof:
Use the Physical Micro-element method:
Assume that at a certain location, after DT time, DT is very small and close to 0
Location change.
Since dt is very small, the angle is close to 0. Therefore, the right triangle containing angle A is close to a slice. The Slice arc length is Ra. The right triangle consisting of DR, Ra, and v2dt is obtained as follows:
Then the two sides are divided by DT:
That is:
W indicates the angular velocity and V indicates the radial velocity. (Of course, this conclusion can be drawn faster by means of speed decomposition)
Get the angular velocity from V1
W = V1/R
So it is a differential equation for solving R. (V = Dr/dt)
However, it is found that when this differential equation is solved, if the yuan is changed
If K = W, it is a constant.
It indicates that it is always established.
Then, the link in the graph can get the trajectory.
However, this question does not require trajectory equations, but it would be better to know the conclusions. In this way, the formula of judgment can be obtained by deriving the Geometric relationship in the middle.
The final conclusion is that arcsin (v1v2) <= (V1/V2) * (D/R) can catch up. Code:
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 }
View code
ACM learning history-hdu4969 just a joke (physics)