#ABC472F. 切片重心 / Centroid of a Slice
切片重心 / Centroid of a Slice
Problem Statement
There is a convex -gon on the -plane. The vertices of are numbered counterclockwise, and the coordinates of vertex are .
Answer questions.
The -th question gives two distinct vertices and . Here, the vertices and are not adjacent on the boundary of .
The segment connecting vertices and divides into two polygons; let be the one lying to the right of the directed line from vertex to vertex . Find the coordinates of the geometric center of (the centroid obtained by regarding the interior of the polygon as a thin plate of uniform density).
Constraints
- form a convex polygon in counterclockwise order.
- All interior angles of are less than degrees.
- Vertices and are not adjacent on the boundary of .
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Output lines. On the -th line, letting be the coordinates of the answer to the -th question, output and in this order, separated by a space.
The answer is considered correct if, for each of and , its absolute or relative error from the true value is at most .
5 4
4 1
1 3
-3 2
-1 -2
2 -1
2 4
5 3
1 4
4 2
-1.000000000000000 1.000000000000000
0.864197530864198 1.209876543209877
0.198198198198198 0.828828828828829
1.391304347826087 0.434782608695652
For the first question, is the triangle with vertices , and its geometric center is .
For the second question, is the quadrilateral with vertices , and its geometric center is .
10 10
480451 142016
404696 274257
7097 390813
-134582 195390
-167108 143104
-359470 -180367
-406293 -273476
74335 -494832
486873 -391664
493159 -292349
5 8
8 6
5 2
5 1
10 3
1 7
3 5
2 5
4 9
1 8
-167917.431926206833203 -207268.968943785114349
126221.026579795702381 -68771.715180365014040
111801.954824466955586 -124063.178438661167072
99590.935535112756283 -153792.378227918737825
321662.353363423237819 113722.100435559268610
43574.061369374611386 102411.022160871806300
-98197.666666666666667 243102.333333333333333
79984.488622522356481 269160.678085376751920
-3267.792578363696043 -210454.379232334372417
46257.363593155145794 -38546.483790939251583
- Source: AtCoder ABC 472 F
相关
在下列比赛中: