Fastest Drop
Time Limit: 1 Second Memory Limit: 32768 KB
There is a sphere on the groud, and it's center is (0,0,0). A dot P is out
of the sphere.
Please find a dot Q on the sphere, then join P and Q with a direct path to make
a small ball drop from P to Q the fastest.
(There will be no friction at all. )
Input
Input consists of several test cases. Each case will contain 4 positive integer
x, y, z and R.
x, y, z mean the position of the dot P. R is the radius of the sphere. (z >
0, R > 0)
The input ends with 0 0 0 0.
Output
Output like this: The ball need xxx seconds slide to the dot (x1, y1, z1).
x1, y1, z1 mean the dot Q. And xxx means the drop time.
Accurate to 4 decimal places.
Sample Input
10 10 10 5 0 0 0 0
Sample Output
The ball need 1.9343 seconds slide to the dot (3.5294,3.5294,0.2941)Submit
Source: ZOJ Monthly, March 2004