time limit per test: 0.25
memory limit per test: 65536
On a flat table there are two circles having centers A and B, radii r_A and r_B, masses m_A and m_B and speeds v_A and v_B respectively:
You are given the initial positions, speeds, radii and masses of the circles. You have to find their positions and speeds after time t. It is guaranteed that the circles do not have any common points in the beginning and after time t.
You may use the following facts:
- The speeds of the circles change only if they hit each other.
- During a hit, the speeds may change only by vectors parallel to vector AB.
- The values P=m_A*v_A+m_B*v_B and 2E=m_A*|v_A|^2+m_B*|v_B|^2 do not change all the time, including hits.
The first two lines of the input contain the descriptions of circles A and B respectively. The description of a circle consists of the coordinates of its center, and its speed, its radius and mass. The coordinates are integer and do not exceed 10^4 by absolute value. The radius is a positive integer and does not exceed 10^4. The mass is a positive integer and does not exceed 100. The third line of the input contains single integer t (0 <= t <= 100).
Output the information about the circles after time t has passed in the same format as in the input, excluding the radius and the mass. The numbers must have at least 3 digits after the decimal point.
0 1 1 0 2 1
5 0 0 0 2 1
1.369 1.938 0.062 0.242
8.631 -0.938 0.938 -0.242
|Resource:||Novosibirsk SU Contest #2, by Novosibirsk Team #1
|Server time: 2017-09-22 15:43:13||Online Contester Team © 2002 - 2016. All rights reserved.|