CF8D.Two Friends
省选/NOI-
通过率:0%
时间限制:1.00s
内存限制:64MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Two neighbours, Alan and Bob, live in the city, where there are three buildings only: a cinema, a shop and the house, where they live. The rest is a big asphalt square.
Once they went to the cinema, and the film impressed them so deeply, that when they left the cinema, they did not want to stop discussing it.
Bob wants to get home, but Alan has to go to the shop first, and only then go home. So, they agreed to cover some distance together discussing the film (their common path might pass through the shop, or they might walk circles around the cinema together), and then to part each other's company and go each his own way. After they part, they will start thinking about their daily pursuits; and even if they meet again, they won't be able to go on with the discussion. Thus, Bob's path will be a continuous curve, having the cinema and the house as its ends. Alan's path — a continuous curve, going through the shop, and having the cinema and the house as its ends.
The film ended late, that's why the whole distance covered by Alan should not differ from the shortest one by more than _t_1, and the distance covered by Bob should not differ from the shortest one by more than _t_2.
Find the maximum distance that Alan and Bob will cover together, discussing the film.
两位邻居——艾伦(Alan)和鲍勃(Bob)——住在一座城市里,该城市仅有三座建筑:一家电影院、一家商店,以及他们共同居住的住宅。其余区域是一片巨大的沥青广场。
某日,他们一同前往电影院观影,影片给他们留下了极为深刻的印象;因此,当他们离开电影院后,仍不愿停止对影片的讨论。
鲍勃希望直接回家,而艾伦则必须先去商店,然后再回家。于是,他们约定:先共同走一段路程(这段共同路径可能经过商店,也可能围绕电影院绕圈行走),边走边继续讨论影片;之后再分道扬镳,各自按自己的路线前往目的地。一旦分开,他们便开始思考各自的日常事务;即使之后再次相遇,也无法继续影片讨论。因此,鲍勃的路径是一条以电影院和住宅为端点的连续曲线;而艾伦的路径则是一条以电影院和住宅为端点、且必须经过商店的连续曲线。
由于电影散场时间很晚,因此艾伦所走的总路程与最短可能路程之间的差值不得超过 t1,鲍勃所走的总路程与最短可能路程之间的差值不得超过 t2。
求艾伦和鲍勃在讨论影片过程中所能共同行走的最大距离。
输入格式
The first line contains two integers: _t_1, _t_2 (0 ≤ _t_1, _t_2 ≤ 100). The second line contains the cinema's coordinates, the third one — the house's, and the last line — the shop's.
All the coordinates are given in meters, are integer, and do not exceed 100 in absolute magnitude. No two given places are in the same building.
第一行包含两个整数:t1、t2(0≤t1,t2≤100)。第二行给出电影院的坐标,第三行给出住宅的坐标,最后一行给出商店的坐标。
所有坐标均以米为单位,为整数,且其绝对值不超过 100。任意两个给定地点均不在同一栋建筑中。
输出格式
In the only line output one number — the maximum distance that Alan and Bob will cover together, discussing the film. Output the answer accurate to not less than 4 decimal places.
在唯一的一行中输出一个数字——Alan 和 Bob 一起边讨论电影边行走的最大距离。答案需精确到不少于小数点后 4 位。
输入输出样例
输入#1
0 2 0 0 4 0 -3 0
输出#1
1.0000000000
输入#2
0 0 0 0 2 0 1 0
输出#2
2.0000000000
输入解题思路,AI测评打分。不知道怎么写?