编程介的小学生 2017-04-05 13:14 采纳率: 20.5%
浏览 758
已采纳

Crankshaft

One company develops a CAD system for crankshaft design. The crankshafts in question are combined of 0 < N <= 100 metal plates. All plates are made of the same alloy and have equal (small) thickness. Each plate has the shape of a polygon with 3 <= Vi <= 200 vertices. All plates in the crankshaft are parallel and firmly connected to each other. They are the only elements of the crankshaft.

Among other features, this CAD system should have a routine for determining the rotation axis of the crankshaft. More precisely, customers sometimes need to find a line, perpendicular to the plane of the crankshaft plates, rotation around which causes minimal vibration of the crankshaft. It is well known that such axis must pass through the mass center of the crankshaft.

The crankshaft design is stored as a set of vertex coordinates for each plate in some Cartesian coordinate system. The plane OXY of the system is parallel to the plates surfaces. All the coordinates are integer, -10^4 <= Xij, Yij <= 10^4, where 1 <= j <= Vi, 1 <= i <= N. The vertices are numbered clockwise (OX axis is directed rightwards, OY axis is directed upwards).

Your program should print the rotation axis coordinates (XR and YR). The correct answer should be given even for a partially designed crankshaft (consisting of two or more non-connected parts). You should suppose that these parts are firmly connected.

Input

The input consists of integer numbers, delimited by spaces and/or line feeds. The numbers are specified in the following order:

N
V1 X11 Y11 ... X1V1 Y1V1
...
VN XN1 YN1 ... XNVN YNVN

Output

The output should contain two real numbers: XR and YR. These values must be exact to four digits to the right of the decimal point.

This problem contains multiple test cases!

The first line of a multiple input is an integer N, then a blank line followed by N input blocks. Each input block is in the format indicated in the problem description. There is a blank line between input blocks.

The output format consists of N output blocks. There is a blank line between output blocks.

Sample Input

2

2
4 -1 -1 -1 1 1 1 1 -1
4 -1 -1 -1 0 0 0 0 -1

2
3 -2 -1 -2 1 -1 0
3 2 1 2 -1 1 0

Sample Output

-0.1 -0.1

0 0

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-04-18 15:40
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么