Pro.ID22057 TitleReflections Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22057 AC0 Submit442 Ratio0.00% 时间&空间限制描述Rendering realistic images of imaginary environments or objects is an interesting topic in computer graphics. One of the most popular methods for this purpose is ray-tracing. The following figure shows a typical path that a ray of light may take in such a scene: Your task is to write a program, that given a scene description and a ray entering the scene, determines which spheres are hit by the ray. 输入The input consists of a series of scene descriptions. Each description starts with a line containing the number n ( n <= 25 ) of spheres in the scene. The following n lines contain three integers xi, yi, ri each, where (xi, yi) is the center, and ri > 0 is the radius of the i-th sphere. Following this is a line containing four integers x, y, dx, dy, which describe the ray. The ray originates from the point (x, y) and initially points in the direction (dx, dy). At least one of dx and dy will be non-zero. 输出Description Rendering realistic images of imaginary environments or objects is an interesting topic in computer graphics. One of the most popular methods for this purpose is ray-tracing. The following figure shows a typical path that a ray of light may take in such a scene: Your task is to write a program, that given a scene description and a ray entering the scene, determines which spheres are hit by the ray. Input The input consists of a series of scene descriptions. Each description starts with a line containing the number n ( n <= 25 ) of spheres in the scene. The following n lines contain three integers xi, yi, ri each, where (xi, yi) is the center, and ri > 0 is the radius of the i-th sphere. Following this is a line containing four integers x, y, dx, dy, which describe the ray. The ray originates from the point (x, y) and initially points in the direction (dx, dy). At least one of dx and dy will be non-zero. Output For each scene first output the number of the scene. Then print the numbers of the spheres that the ray hits in its first ten deflections (the numbering of spheres is according to their order in the input). If the ray hits at most ten spheres (and then heads towards infinity), print inf after the last sphere it hits. If the ray hits more than 10 spheres, print three points (...) after the tenth sphere. Output a blank line after each test case.Sample Input 3
3 3 2
7 7 1
8 1 1
3 8 1 -4
2
0 0 1
5 0 2
2 0 1 0
0 Sample Output Scene 1
1 2 1 3 inf
Scene 2
2 1 2 1 2 1 2 1 2 1 ... Source 样例输入3
3 3 2
7 7 1
8 1 1
3 8 1 -4
2
0 0 1
5 0 2
2 0 1 0
0 样例输出Scene 1
1 2 1 3 inf
Scene 2
2 1 2 1 2 1 2 1 2 1 ... 作者 |