Following the previous problem Billiard Ball Collisions...
After warming up with some practice shots, Mary reaches into her equipment bag and grabs her heavyweight cue-ball, and prepares to execute some very tricky shots.
This is the same model as the previous problem, though with much larger numbers resulting in many more collisions.
All assumptions from the previous problem also apply to this one:
r = 2.8 cm.All values of mass are in units of grams, lengths in units of centimeters,
and velocities in units of meters per second.
Recall that much of the information given in each testcase is not necessary to calculate the exact solution.
Input Data
First line will be Q, the quantity of testcases.
Q lines will then follow, each in the format m_8 m_cue x_8 x_cue v_cue.
Answer
Should consist of Q space-separated integers, corresponding to the total number of
collisions that the 8-ball makes with both the cue-ball and the back bumper.
Note that you have just 3 minutes to solve the problem after you are given your input data; so
please reload the page to get new input before calculating and submitting the answer.
If you find that the problem is difficult to simulate within the time limit, try to find a direct solution which doesn't involve iterative simulation...
Example
input data:
2
1 123456789 1234567 87654321 0.123
2 987654321 3.456 9.876 87654321
3 300000000 31.415 314.15 31415926
answer:
34906 69813 31415