1563 - A Very Simple Problem
Time Limit : 1 Second
Memory Limit : 128 MB
Submission: 381
Solved: 56
- Description
- There’s a cuboid (a*b*c) with a magic ball(radius R) which can move freely in it placed in the 3-Dspace as described in the picture below. If the ball’s initial velocity is (Vx,Vy,Vz) per second and its center’s initial position is (Px,Py,Pz), there comes the question that where it will be in T seconds later?
We guarantee that the WHOLE ball is always IN the cuboid, and collisions between the ball and the inner faces of this cuboid satisfy the Conservation of Kinetic Energy(it means there isn’t any kinetic energy loss in the collisions) and the Law of Reflection, moreover, there’s no friction in the movement, too.
- Input
- The input starts with a line containing a single number N, the number of test cases, then N test cases follows.
Each test case consists of three lines:
The first line contains three numbers a, b, c. (0.0<a,b,c<=1.0*10^4)
The second line contains four numbers R,Px,Py,Pz.
(0.0 <R,Px,Py,Pz<=1.0*10^4)
The third line contains four numbers Vx, Vy, Vz, T.
(-1.0*10^4<=Vx,Vy,Vz<=1.0*10^4, 0.0 <=T<=1.0*10^9)
There will be a blank line after each test case.
- Output
- For each test case just output one line, starting with “Case #X: ”and followed by three numbers Fx, Fy, Fz, rounded to one decimal places and separated by a single space, which represent the ball’s center’s final position after T seconds.(Please note that there’s a space after ‘:’, and X means the No. of that test case.)
Please see samples for more details.
- sample input
-
2 10.0 20.0 30.0 2.0 5.0 10.0 15.0 1.0 1.0 1.0 100.0 29.9 40.9 49.9 10.0 15.0 15.0 15.1 0.9 2.0 3.0 1000000.0
- sample output
-
Case #1: 7.0 14.0 11.0 Case #2: 14.0 10.4 28.5
- hint
- source
- Zhou ZHOU