283. Mechanics
time limit per test: 0.25
sec.
memory limit per test: 65536
KB
input: standard
output: standard
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.
Input
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
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.
Sample test(s)
Input
0 1 1 0 2 1
5 0 0 0 2 1
5
Output
1.369 1.938 0.062 0.242
8.631 0.938 0.938 0.242
Author: 

Resource:  Novosibirsk SU Contest #2, by Novosibirsk Team #1

Date: 

Server time: 20171121 05:21:21  Online Contester Team © 2002  2016. All rights reserved. 

