#abc274e. E - Booster
E - Booster
Score : points
问题描述
在二维平面上,有 个城镇和 个宝箱。第 个城镇位于坐标 ,第 个宝箱位于坐标 。
高桥将进行一次旅行,他从原点出发,访问所有 个城镇,然后返回原点。 虽然不一定需要访问宝箱,但每个宝箱中都包含一个加速器。每次他拾取加速器时,他的移动速度都会翻倍。
高桥的初始移动速度为 。求完成这次旅行所需的最短时间。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
In a two-dimensional plane, there are towns and chests. Town is at the coordinates , and chest is at the coordinates .
Takahashi will go on a trip where he starts at the origin, visits all towns, and then returns to the origin.
It is not mandatory to visit chests, but each chest contains an accelerator. Each time he picks up an accelerator, his moving speed gets multiplied by .
Takahashi's initial moving speed is . Find the shortest time needed to complete the trip.
Constraints
- , , and are distinct.
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer. Your output will be considered correct if the absolute or relative error from the judge's answer is at most .
Sample Input 1
2 1
1 1
0 1
1 0
Sample Output 1
2.5000000000
Here is one optimal way to complete the trip.
- Go the distance from the origin to chest at a speed of , taking a time of .
- Go the distance from chest to town at a speed of , taking a time of .
- Go the distance from town to town at a speed of , taking a time of .
- Go the distance from town to the origin at a speed of , taking a time of .
Sample Input 2
2 1
1 1
0 1
100 0
Sample Output 2
3.4142135624
Here is one optimal way to complete the trip.
- Go the distance from the origin to town at a speed of , taking a time of .
- Go the distance from town to town at a speed of , taking a time of .
- Go the distance from town to the origin at a speed of , taking a time of .
Sample Input 3
1 2
4 4
1 0
0 1
Sample Output 3
4.3713203436
Here is one optimal way to complete the trip.
- Go the distance from the origin to chest at a speed of , taking a time of .
- Go the distance from chest to chest at a speed of , taking a time of .
- Go the distance from chest to town at a speed of , taking a time of .
- Go the distance from town to the origin at a speed of , taking a time of .
update @ 2024/3/10 11:33:01