Problem D
Cheetah
Input: standard input
Output: standard output
Time Limit: 1 second
The cheetah is a beautiful hunting
animal. Although it can gain incredible speed, it tires soon and so cannot
maintain the speed for long. So in an attempt to catch a prey, the cheetah must
choose a path of minimum length.
The
cheetah quietly and discreetly closes in on the prey. When the cheetah is at
position (Cx, Cy) and the prey at position (Px, Py), the prey
realizes that the cheetah is close by and starts running with the constant
speed of U feet per second at an angle P with the positive
direction of X-axis. The cheetah also starts running at a constant speed of V
feet per second at an angle C to ensure that he can catch the prey with
minimum effort. The cheetah, however, cannot maintain the speed for more than L
seconds.
Provided
the values of Cx, Cy, Px, Py, P, U, V, L, you have to find C, T, X, Y,
where T is the time required for the cheetah to catch the prey and (X,Y)
is the position at which the cheetah catches the prey.
The co-ordinates are in feet and range between [0, 10000]. The angles
are in degrees and range between [0, 360]. The velocities range between [0,
500]. L ranges between [0, 10000].
For
each test case, if the cheetah can catch the prey, then print the values of C,
T, X, Y in that order. Each value should have 2-digits after the decimal
point. If the cheetah cannot catch the prey within L seconds, then print
"sorry, buddy".
2 0 0 6 0 135 1 1 10 0 0 6 0 135 1 1 3 |
45.00 4.24 3.00 3.00 sorry, buddy
|
Problem setter: Sadrul Habib Chowdhury
Special Thanks: Derek Kisman, EPS.