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

建议使用的浏览器:

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

4491:Windmill Animation

题目描述
A windmill animation works as follows:
A two-dimensional set of points, no three of which lie on a line is chosen. Then one of the points is chosen (as the first pivot) and a line is drawn through the chosen point at some initial angle. The animation proceeds by rotating the line counter-clockwise about the pivot at a constant rate. When the line hits another of the points, that point becomes the new pivot point. In the two examples below, the points are (-1,1), (1,1), (0,0), (-1,-2) and (1,-2).

Example 1


In Example 1, the start point is point 1 and the line starts rotated 45 degrees from horizontal. When the line rotates to 90 degrees, point 4 is hit and becomes the new pivot. Then point 5 becomes the new pivot, then point 2 then point 1.

Example 2


In Example 2, the initial point is point 3 and the line starts horizontal. At 45 degrees, point 2 becomes the pivot, then at about 56 degrees, point 4 becomes the pivot. At about 63 degrees, point 3 becomes the pivot again, then point 5, point 1 and back to 3 as at the start.

Write a program, which takes as input the points of the set, the initial point and the initial line angle and outputs the sequence of pivot points.
输入解释
The first line of input contains a single integer P, (1<= P <= 1000), which is the number of data sets that follow. Each data set should be processed identically and independently.

Each data set consists of multiple lines of input. The first line of each data set consists of four space- separated decimal integers followed by a single floating-point value. The first integer is the data set number. The second integer is the number of points M to follow (3 <= M <= 20). The third integer gives the number, s , of the pivot points to output (3 <= s <= 20) and the fourth integer gives the index, I, of the initial point (1 <= I <= M). The floating-point value is the angle, A, in degrees, that the initial line is rotated counter-clockwise from horizontal (0 <= A < 180).

The remaining M lines in the data set contain the coordinates of the set of points. Each line consists of an integer, the point.s index, I, and two floating-point values, the X and Y coordinates of the point respectively.
输出解释
For each data set there is a single line of output. It contains the data set number, followed by s space separated point indices (excluding the initial point index).
输入样例
2
1  5  5  1  45
1  -1  1
2  1  1
3  0  0
4  -1  -2
5  1  -2
2  5  7  3  0
1  -1  1
2  1  1
3  0  0
4  -1  -2
5  1  -2
输出样例
1 4 5 2 1 4
2 2 4 3 5 1 3 2
来自杭电HDUOJ的附加信息
Recommend liuyiding

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

题目来源 Greater New York 2012

源链接: HDU-4491

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

共提交 0

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