22150_Poo

2022-5-16 18:21| 发布者: Hocassian| 查看: 23| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506152471700-Problem List-采集的数据-后羿采集器.html

Pro.ID

22150

Title

Pool

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22150

AC

3

Submit

10

Ratio

30.00%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    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
    0.729627 -0.683845334 0.198022 -0.9801975758 0.314911 -0.9491212052 -0.735596 -0.6774204933
    1
    0.517308 0.8557992949 0.936038 -0.351898938 0.396901 -0.9178614254 0.616543 -0.7873212363

    Sample Output

    1.15
    0.26

    Source

    样例输入

    1
    0.729627 -0.683845334 0.198022 -0.9801975758 0.314911 -0.9491212052 -0.735596 -0.6774204933
    1
    0.517308 0.8557992949 0.936038 -0.351898938 0.396901 -0.9178614254 0.616543 -0.7873212363

    样例输出

    1.15
    0.26

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部