21287_Coverage

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

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

Pro.ID

21287

Title

Coverage

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    A cell phone user is travelling along a line segment with end points having integer coordinates. In order for the user to have cell phone coverage, it must be within the transmission radius of some transmission tower. As the user travels along the path, cell phone coverage may be gained (or lost) as the user moves inside the radius of some tower (or outside of the radii of all towers). Given the location of up to 100 towers and their transmission radii, you are to compute the percentage of cell phone coverage the user has along the specified path. The (x,y) coordinates are integers between -100 and 100, inclusive, and the tower radii are integers between 1 and 100, inclusive.

    输入

    Your program will be given a sequence of configurations, one per line, of the form:

    N C0X C0Y C1X C1Y T1X T1Y T1R T2X T2Y T2R ... 

    Here, N is the number of towers, (C0X, C0Y) is the start of path of the cell phone user, (C1X, C1Y) is the end of the path, (TkX, TkY) is the position of the kth tower, and TkR is its transmission radius. The start and end points of the paths are distinct.

    The last problem is terminated by the line

    0

    输出

    Description
    A cell phone user is travelling along a line segment with end points having integer coordinates. In order for the user to have cell phone coverage, it must be within the transmission radius of some transmission tower. As the user travels along the path, cell phone coverage may be gained (or lost) as the user moves inside the radius of some tower (or outside of the radii of all towers). Given the location of up to 100 towers and their transmission radii, you are to compute the percentage of cell phone coverage the user has along the specified path. The (x,y) coordinates are integers between -100 and 100, inclusive, and the tower radii are integers between 1 and 100, inclusive.
    Input

    Your program will be given a sequence of configurations, one per line, of the form:

    N C0X C0Y C1X C1Y T1X T1Y T1R T2X T2Y T2R ... 

    Here, N is the number of towers, (C0X, C0Y) is the start of path of the cell phone user, (C1X, C1Y) is the end of the path, (TkX, TkY) is the position of the kth tower, and TkR is its transmission radius. The start and end points of the paths are distinct.

    The last problem is terminated by the line

    0
    Output
    For each configuration, output one line containing the percentage of coverage the cell phone has, rounded to two decimal places.
    Sample Input
    3 0 0 100 0 0 0 10 5 0 10 15 0 10
    1 0 0 100 0 40 10 50
    0
    Sample Output
    25.00
    88.99
    Source

    样例输入

    3 0 0 100 0 0 0 10 5 0 10 15 0 10
    1 0 0 100 0 40 10 50
    0

    样例输出

    25.00
    88.99

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部