-->
当前位置:首页 > 题库

PROGRAMMING:How much

Luz5年前 (2021-05-10)题库437
The n vertices P0, P1, ····, PN − 1 of a convex polygon are given in counterclockwise direction, and then a point Q inside the convex polygon (including the boundary) is given. Now roll the convex polygon on the ground for one circle without sliding. At the beginning, p0p1 edge contacts the ground. Suppose PIP (I + 1) mod n edge contacts the ground at present, then after rolling, P (I + 1) mod NP (I + 2) mod n edge contacts the ground. It is not difficult to find that after rolling n times from the initial state, the side of p0p1 contacts the ground again. At this time, the convex polygon is considered to have rolled for a week. Keven now wants to know the length of the track of point Q after a convex polygon rolls for a week, so he asked you, can you help him solve this problem?
###Input format:
The first line contains an integer t (T < 10), which represents the number of groups of test data.
Next, the test data of group T are described in turn. For each group of test data:
The first line contains an integer n, which represents the number of vertices of the convex polygon. Next, N lines, each line contains two integers Xi, Yi, and the coordinates of n vertices P1, P2, ·····································································.
The last line contains two integers XQ, YQ, which represent the coordinates of point Q.
Ensure that the point q is inside the convex polygon (including the boundary).
###Output format:
For each group of test data, output a line of information "case # X: Y" (without quotation marks), where X represents the x-th group of test data, Y represents the track length of point Q after a convex polygon rolls for one week, and the rounding is accurate to 3 decimal places. The data ensures that the fourth decimal place of the answer is not 4 or 5.
###Input example:
Here is a set of inputs. For example:
```in
two
four
0 0
0 1
1 1
1 0
0 0
four
0 0
0 2
2 2
2 0
1 1
```
###Output example:
The corresponding output is given here. For example:
```out
Case #1: 5.363
Case #2: 8.886
```







answer:If there is no answer, please comment