#abc286h. Ex - Don't Swim
Ex - Don't Swim
Score : points
问题描述
在一个二维平面上,存在一个有 个顶点的凸多边形 ,以及两个点 和 。多边形 的顶点按逆时针顺序依次为 。保证 和 都在多边形外部。
求从点 到点 的最短路径长度,要求该路径除了经过多边形 的边界外,不能进入其内部。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
On a two-dimensional plane, there is a convex polygon with vertices, and points and . The vertices of are , and in counterclockwise order. It is guaranteed that and are outside the polygon.
Find the shortest distance that needs to be traveled to get from point to point without entering the interior of except for its circumference.
Constraints
- , and form a convex polygon in counterclockwise order.
- No three points of are colinear.
- and are outside and not on the circumference of .
- 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 is considered correct if the absolute or relative error from the true value is at most .
Sample Input 1
4
1 1
3 1
3 3
1 3
0 2
5 2
Sample Output 1
5.65028153987288474496
One way to achieve the shortest distance is shown in the following figure.
If you travel as , the length of the path from point to point is . We can prove that it is the minimum. Note that you may enter the circumference of .
Note that your output is considered correct if the absolute or relative error is at most . For example, output like 5.650287
is also considered correct.
Sample Input 2
3
0 0
2 0
1 10
3 7
10 3
Sample Output 2
8.06225774829854965279
update @ 2024/3/10 11:59:03