当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

4962:Closed Paths

题目描述
JFantasy has fallen in love with a beautiful girl (An ICPC volunteer?). Every afternoon, when the sun set, the girl comes out from her dorm, walks around the campus, and returns to her dorm. The girl’s walking path can be considered as a closed polyline. A closed polyline is a curve specified by a sequence of points (P1, P2, …, Pn) so that the curve consists of the line segments P1P2, P2P3, …, Pn-1Pn, PnP1. Note that two line segments may intersect, coincide or partially coincide with each other. The points P1, P2, …, Pn are also called vertices of the polyline. While the girl is walking along the path, JFantasy is standing at some point which is not lying on the path. During the girl’s walking, the spoony boy rotates himself such that he can always see the girl directly in front of him. The boy may sometimes rotate counter-clockwise, and sometimes rotate clockwise. If the boy stands at point P, let AP denote the total degrees the boy rotate counter-clockwise, and BP denote the total degrees the boy rotate clockwise. It is not difficult to see that AP – BP is a multiple of 360, because when the girl finishes walking, the boy faces in the same direction as when the girl starts walking. We define the rotation number of P to be (AP – BP) / 360.

LCQ is one of JFantasy’s G (G for good) friends. He has found JFantasy’s secret, and got an idea of making fun of him. He wants to put JFantasy at some point of which the rotation number is maximum given the walking path of the girl. To simplify the problem, we assume that the point where JFantasy can be put must be on a straight line. Formally, the problem can be stated as follows: Given the coordinates of (P1, P2, …, Pn), which specifies the girl’s walking path, you are asked to find the largest possible rotation number among all the points that are on the X axis, but not on the girl’s walking path.
输入解释
The input begins with a line containing an integer T (T<=100), which indicates the number of test cases. Each case begins with a line containing an integer N (2<=N<=1000), indicating the number of vertices of the girl’s walking path. The following N lines each contain two integers xi and yi (-1000<= xi, yi <=1000), indicating the coordinates of the ith vertex Pi.
输出解释
For each case, output the largest possible rotation number in a line.
输入样例
3
2
1 2
2 1
6
1 -1
2 -1
2 1
3 1
3 0
1 0
5
1 1
-1 0
1 -1
0 1
0 -1
输出样例
0
0
2
来自杭电HDUOJ的附加信息
Author SYSU
Recommend

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-4962

最后修改于 2020-10-25T23:18:27+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 131072/131072K(Java/Others)