
ZOJ Problem Set  3728
There's a round medal fixed on an ideal smooth table, Fancy is trying to throw some coins and make them slip towards the medal to collide. There's also a round range which shares exact the same center as the round medal, and radius of the medal is strictly less than radius of the round range. Since that the round medal is fixed and the coin is a piece of solid metal, we can assume that energy of the coin will not lose, the coin will collide and then moving as reflect. Now assume that the center of the round medal and the round range is origin ( Namely (0, 0) ) and the coin's initial position is strictly outside the round range. Given radius of the medal R_{m}, radius of coin r, radius of the round range R, initial position (x, y) and initial speed vector (vx, vy) of the coin, please calculate the total time that any part of the coin is inside the round range. Please note that the coin might not even touch the medal or slip through the round range. InputThere will be several test cases. Each test case contains 7 integers R_{m}, R, r, x, y, vx and vy in one line. Here 1 ≤ R_{m} < R ≤ 2000, 1 ≤ r ≤ 1000, R + r < (x, y) ≤ 20000, 1 ≤ (vx, vy) ≤ 100. OutputFor each test case, please calculate the total time that any part of the coin is inside the round range. Please output the time in one line, an absolute error not more than 1e3 is acceptable. Sample Input5 20 1 0 100 0 1 5 20 1 30 15 1 0 Sample Output30.000 29.394 Author: FAN, Yuzhe Contest: The 2013 ACMICPC Asia Changsha Regional Contest 