Balls Collision | ||||||
| ||||||
Description | ||||||
There is an absolutely slippery groove whose length is M miles and the width is 0.2 mile. N balls whose weights are all the same and the radiuses are all 0.1 mile roll in the groove at the speed of 1mile/s in the direction of left or right. when two balls come into collision, there is no energy lost. | ||||||
Input | ||||||
The input file contains several test cases. The description of each case starts with a line containing two integers M (0<=M<=1000000) and N (1<=N<=100). Each of the following N lines contains the direction (R presents the direction of right and L presents the direction of left) and the distance (in miles) from the left side of the groove at starting time. | ||||||
Output | ||||||
For each test case you should output the time (in second) at which the first ball rolls down the groove and the time (in second) at which the last ball rolls down the groove in a single line. | ||||||
Sample Input | ||||||
10 2 | ||||||
Sample Output | ||||||
1 7 这题都快做烂了啊= =蚂蚁感冒
|
Hust oj 1046 Balls Collision(水题)
最新推荐文章于 2020-11-21 12:04:00 发布