当前位置: 代码迷 >> 综合 >> Two Friends(翻译)
  详细解决方案

Two Friends(翻译)

热度:6   发布时间:2023-12-05 14:33:55.0

2022.1.26

题目网址:

https://acs.jxnu.edu.cn/problem/CF8D

原题:

Two Friends

 1000ms  65536K

描述:

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.

翻译:

有两个邻居,艾伦和鲍勃,住在一座只有三个建筑的城市,那儿只有一个电影院,一个商店,和一个房子。剩下的是一个大的沥青广场。

有一次他们去这个电影院,他们在这看的电影给他们留下了非常深刻的印象,以至当他们离开电影院的时候,他们还是忍不住去讨论它。

鲍勃想回家,但是艾伦必须先去一趟商店,然后再回家。所以,他们同意在顺路的一段距离内讨论这个电影(他们顺路的距离可能会穿过商店,或者他们可能一起在电影院周围绕圈),然后分开,各走各的路。在他们分开之后,他们开始思考他们的日常追求,甚至如果他们再一次见面的话,他们将不会继续讨论这部电影。因此,鲍勃的路径将是一条连续的曲线,以电影院和房子为终点。艾伦的路是一条连续的曲线,穿过商店,以电影院和房子为终点。

这个电影结束得比较晚,那就是为什么艾伦所走过的距离与最短距离的差值不应该大于t1,并且鲍勃所走过的距离与最短距离的差值不应该大于t2.

找到艾伦和鲍勃顺路讨论电影的最大距离。

输入:

第一行包括两个整数:t1,t2(0<=t1,t2<=100)。第二行包括电影院的坐标,第三行是房子的坐标,最后一行是商店的坐标。

所有给出的坐标单位是米,是整数,绝对数量级不超过100.没有两个给的位置在同一栋楼里。

输出:

只有唯一一行输出---艾伦和鲍勃顺路讨论电影的最大距离。输出的答案确保精确到小数点不少于后4位。