A7793 | Two Friends
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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是两位邻居,住在同一个城市中。然而,这个城市只有三栋建筑物,分别是电影院、一个商铺和他们居住的居民楼。剩下的就是空空荡荡的柏油路了。
有一天,他们去了电影院看电影,电影触动了他们。当他们看完电影离场后,他们一直在谈论有关电影的内容,久久不能停息。
Bob想要回家,但是Alan想要先去商铺一趟,然后再回家。他们约定好一起走一段路来谈论有关电影的事宜(他们同时走的路可能会经过商店,他们也可以围绕着电影院兜圈)。然后两个人分别各自前往自己的家家。分开后,他们会开始思考自己的日常追求(白日梦);即使再次见面,他们也不会再讨论有关电影的事宜了。因此,Bob的路径将是一条连续的曲线,以电影院和房子为终点。Alan的路径——一条连续的曲线,穿过商店,以电影院和房子为终点。
电影结束得很晚,这就是为什么Alan走过的整个距离与最短距离的差距不应超过$t1$,而Bob走过的距离与最短距离的差距不应超过$t2$。
你的任务是出求Alan和Bob在讨论电影时一起走过的最大距离。
感谢[Macw](https://www.acgo.cn/person/929871)提供翻译
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是两位邻居,住在同一个城市中。然而,这个城市只有三栋建筑物,分别是电影院、一个商铺和他们居住的居民楼。剩下的就是空空荡荡的柏油路了。
有一天,他们去了电影院看电影,电影触动了他们。当他们看完电影离场后,他们一直在谈论有关电影的内容,久久不能停息。
Bob想要回家,但是Alan想要先去商铺一趟,然后再回家。他们约定好一起走一段路来谈论有关电影的事宜(他们同时走的路可能会经过商店,他们也可以围绕着电影院兜圈)。然后两个人分别各自前往自己的家家。分开后,他们会开始思考自己的日常追求(白日梦);即使再次见面,他们也不会再讨论有关电影的事宜了。因此,Bob的路径将是一条连续的曲线,以电影院和房子为终点。Alan的路径——一条连续的曲线,穿过商店,以电影院和房子为终点。
电影结束得很晚,这就是为什么Alan走过的整个距离与最短距离的差距不应超过$t1$,而Bob走过的距离与最短距离的差距不应超过$t2$。
你的任务是出求Alan和Bob在讨论电影时一起走过的最大距离。
感谢[Macw](https://www.acgo.cn/person/929871)提供翻译
输入格式
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$。
第二行输入电影院的坐标。
第三行输入房子的坐标。
第四行输入商铺的坐标。
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$。
第二行输入电影院的坐标。
第三行输入房子的坐标。
第四行输入商铺的坐标。
输出格式
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一起走过的最大路程。本题采用Special Judge,输出小数与标准解的误差在万分之一内可被接受。
输出包含一个浮点数,表示Alan和Bob一起走过的最大路程。本题采用Special Judge,输出小数与标准解的误差在万分之一内可被接受。
输入输出样例
输入 #1
0 2 0 0 4 0 -3 0
输出 #1
1.0000000000
输入 #2
0 0 0 0 2 0 1 0
输出 #2
2.0000000000
**请注意,本题空间限制为64MB,是默认空间限制的二分之一。**
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted