来源:codeforces:https://codeforces.com/contest/8/problem/D
Two Friends
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 t1, and the distance covered by Bob should not differ from the shortest one by more than t2.
Find the maximum distance that Alan and Bob will cover together, discussing the film.
Input
The first line contains two integers: t1,?t2 (0?≤?t1,?t2?≤?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.
Output
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.
Examples
input
0 2 0 0 4 0 -3 0
output
1.0000000000
input
Copy
0 0 0 0 2 0 1 0
output
2.0000000000
翻译:两个邻居,鲍勃与艾伦住在这个城市。哪里只有三栋建筑,电影院,商店与他们住的这个房子。剩下的是一个大沥青广场。
曾今,他们去了那个电影院,那个电影令他们印象深刻,以至于在他们离开之后,也不想停止讨论它。
鲍勃想回家,但是艾伦不得不先去商店再回家,所以他们同意走一段路讨论这个电影(他们可能一起通过商店,或者一起围绕着电影院转圈),然后再分道扬镳,走自己的路。在分开后,他们开始思考自己的日常追求,即使再次相遇,他们也不会在讨论这个电影。因此鲍勃的路线将是一条连续的曲线,以电影院和房子作为终点。艾伦的路线-一条曲线,通过商店,以电影院和房子作为终点。
电影结束的很晚,那就是为什么,艾伦走过的距离不应该超过最短距离t1,鲍勃走过的距离不应该超过最短距离的t2,。
找到这个最大的距离,鲍勃和艾伦一起讨论电影走过的最大距离。
输入:
第一行包括两个整数t1和t2,(0?≤?t1,?t2?≤?100),第二行是电影院的坐标,下一行是房子的,最后一行是商店的。
所有给定的坐标都一米作为单位,是整数,绝对不会超过100.并且给定的两个地方不会是同一栋建筑。
输出:
只有一行,输出这个数字,鲍勃和艾伦一起讨论电影走过的最大距离。输出的答案准确度不少于四位小数。
asphalt | 英 [??sf?lt] | 美 [??sf??lt] |
n. | 沥青; 柏油; |
vt. | 铺沥青于; 铺柏油于; |
pursuits | 英 [p??sju?ts] | 美 [p?r?suts] |
n. | 追求; 寻找; 追赶; 跟踪; 追捕; 事业; 消遣; 爱好; |
path | 英 [pɑ?θ] | 美 [p?θ] |
n. | 路径; 道路; 路线; 小路; 小径; 行动计划; 成功的途径; |
coordinates | |
英 [k?????d?ne?ts] | 美 [ko????rd?ne?ts] |
v. | 使协调; 使相配合; 使(身体各部分)动作协调; 协同动作; (衣服、家具等)搭配,协调; |
n. | 坐标; (颜色协调的)配套服装,套装; |
magnitude | 英 [?m?ɡn?tju?d] | 美 [?m?ɡn?tu?d] |
n. | 巨大; 重大; 重要性; 星等; 星的亮度; 震级; |