Two Friends
题目(https://acs.jxnu.edu.cn/problem/CF8D)描述:
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.
输入:
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.
输出:
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.
样例输入:
0 2
0 0
4 0
-3 0
样例输出:
1.0000000000
样例输入:
0 0
0 0
2 0
1 0
样例输出:
2.0000000000
翻译:
两个邻居,艾伦和鲍勃,住在一座只有三座建筑的城市里:电影院,商店和他们住的这栋公寓。其他地方是巨大的沥青广场。
他们曾一起去电影院,电影让他们印象深刻以至于他们离开影院的时候还在不停的讨论它。
鲍勃想回家,但是艾伦必须先去商店然后再回家。所以他们同意走同样的路继续讨论电影(这条路也许经过商店或者围着电影院绕圈),然后分开,走各自的路。他们分开后,他们将会开始想他们的日常追求;甚至他们再次遇到了,他们也不会继续讨论电影。因此,鲍勃的路线将会是一条连续曲线,以电影院和公寓为终点。艾伦的路线也是一条连续曲线,经过商店,以电影院和公寓为终点。
电影很晚结束,那就是为什么艾伦走的距离与最短距离的差要小于t1,并且鲍勃走的距离与最短距离的差要小于t2。
找到艾伦和鲍勃走过的可以一起讨论电影的最大距离。
输入:
第一行包含两个整数t1,t2 (0?≤?t1,?t2?≤?100)。第二行包含电影院的坐标,第三行为公寓的坐标,最后一行为商店的坐标。
所有的坐标都是以米为单位的整数,且不超过100。所有坐标各不相同。
输出:
输出一个数字为艾伦和鲍勃走过的可以一起讨论电影的最大距离。保留至少4位小数。
样例输入:
0 2
0 0
4 0
-3 0
样例输出:
1.0000000000
样例输入:
0 0
0 0
2 0
1 0
样例输出:
2.0000000000