#P1337. [JSOI2004] 平衡点 / 吊打XXX

    ID: 334 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>计算几何二分各省省选江苏模拟退火

[JSOI2004] 平衡点 / 吊打XXX

Description

As shown in the figure, there are nn weights, each tied to a sufficiently long rope.

Each rope passes from above through a hole on the tabletop and then they are tied together. The point xx in the figure is the common knot. Assume the ropes are perfectly elastic (i.e., cause no energy loss), the table is high enough (the weights will not reach the ground), and all friction is ignored. Find the final equilibrium position of the knot xx.

Note: The holes on the tabletop are much smaller than the knot xx, so even if some weight is particularly heavy, the knot xx cannot pass through a hole and fall. At most, it will get stuck at the edge of some hole.

Input Format

The first line of the file is a positive integer nn (1n10001 \le n \le 1000), indicating the number of weights and holes.

The next nn lines each contain 33 integers xi,yi,wix_i, y_i, w_i, denoting the coordinates of the ii-th hole and the weight of the ii-th object, respectively (10000xi,yi10000,0<wi1000-10000 \le x_i, y_i \le 10000, 0 < w_i \le 1000).

Output Format

Your program must output two floating-point numbers (rounded to three decimal places), representing the xx-coordinate and yy-coordinate of the knot xx at the final equilibrium position. The two numbers are separated by a space.

3
0 0 1
0 2 1
1 1 1
0.577 1.000

Hint

The testdata guarantees that the balance point is unique, i.e., cases like n=2n=2 with two equal masses will not appear.

Translated by ChatGPT 5