Pro.ID22150 TitlePool Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22150 AC3 Submit10 Ratio30.00% 时间&空间限制描述There is a pool which is circular shape, the centre of the pool is located at (0, 0). And there is a bridge cross over the pool, the bridge is considered as a straight line segment AB on the plane, points A and B are both on the boundary of the pool. Merlin wants to go from points F to G, F and G are also on the boundary of the pool, but he cannot swim. Write a program to tell him the shortest distance from F to G. 输入Input contains multiple test cases. The first line of each test case contains an integers R ( 1 ≤ R ≤ 100 ), representing the radius of the pool. The second line contains eight real numbers XA, YA, XB, YB, XF, YF, XG, YG, representing the coordinates of points A, B, F and G. Each coordinate satisfies |X2+Y2-R2| < 10-8. 输出Description There is a pool which is circular shape, the centre of the pool is located at (0, 0). And there is a bridge cross over the pool, the bridge is considered as a straight line segment AB on the plane, points A and B are both on the boundary of the pool. Merlin wants to go from points F to G, F and G are also on the boundary of the pool, but he cannot swim. Write a program to tell him the shortest distance from F to G. Input Input contains multiple test cases. The first line of each test case contains an integers R ( 1 ≤ R ≤ 100 ), representing the radius of the pool. The second line contains eight real numbers XA, YA, XB, YB, XF, YF, XG, YG, representing the coordinates of points A, B, F and G. Each coordinate satisfies |X2+Y2-R2| < 10-8. Output Output the answer on a single line for each test case, round to two digits after decimal point. Sample Input 1 Sample Output 1.15 Source 样例输入1 样例输出1.15 作者 |