22701_GSMphone

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

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

Pro.ID

22701

Title

GSM phone

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    Mr. X wants to travel from a point A(Xa, Ya) to a point B(Xb, Ya), AB. He has a GSM mobile phone and wants to stay available during whole the trip. A local GSM operator has installed K sets of GSM equipment in points Pi(Xi, Yi),  1 ≤ iK. Each set of the equipment provides circular zone Zi. Point Pi is the center of the zone Zi and Ri is its radius. Mobile phones can operate inside such a zone and on its border. Zones can intersect, but no zone completely includes another one.

    Your task is to find the length of the shortest way from A to B which is completely covered by GSM zones. You may assume that such a way always exists. Precision of calculations has to be 0.00001.

    输入

    The first line contains four floating point numbers Xa Ya Xb Yb, separated by one or more spaces. The next line contains single integer number K ( K ≤ 200 ). Each of the rest K lines of the file contains three floating point numbers Xi, Yi, Ri separated by one or more spaces. Ri > 0.

    输出

    Description

    Mr. X wants to travel from a point A(Xa, Ya) to a point B(Xb, Ya), AB. He has a GSM mobile phone and wants to stay available during whole the trip. A local GSM operator has installed K sets of GSM equipment in points Pi(Xi, Yi),  1 ≤ iK. Each set of the equipment provides circular zone Zi. Point Pi is the center of the zone Zi and Ri is its radius. Mobile phones can operate inside such a zone and on its border. Zones can intersect, but no zone completely includes another one.

    Your task is to find the length of the shortest way from A to B which is completely covered by GSM zones. You may assume that such a way always exists. Precision of calculations has to be 0.00001.

    Input

    The first line contains four floating point numbers Xa Ya Xb Yb, separated by one or more spaces. The next line contains single integer number K ( K ≤ 200 ). Each of the rest K lines of the file contains three floating point numbers Xi, Yi, Ri separated by one or more spaces. Ri > 0.

    Output

    Output a single floating point number.

    Sample Input

    0 0 8 0
    2
    0 4 5
    8 4 5

    Sample Output

    8.24621

    Source

    样例输入

    0 0 8 0
    2
    0 4 5
    8 4 5

    样例输出

    8.24621

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部