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

建议使用的浏览器:

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

2981:Shoot Your Gun!

题目描述
There are two rectangular polygons (simple polygons with interior angles of only 90 or 270 degrees) G and T , inside another rectangular polygon M . You can place a gun anywhere on the boundary of G , then shoot a bullet in one of four diagonal directions, and then touch the boundary of T . You may shoot across an edge of T , but touching only a corner is also allowed. Your bullet is not allowed to touch G again (even touching a corner of G is not allowed), before touching T .



The edges of M can reflect the bullet. When the bullet touches a vertex of M , it may simply go through it (and not regarded as a reflection), or go back. These special cases are shown in the figure above.

Write a program to find the minimal number of reflections needed from G to T .
输入解释
The input contains several test cases. The first line of each case contains three positive integers nG, nT, nM (4<=nG, nT, nM<=50) . The next line contains nG pairs of integers, the coordinates (non-negative integers not greater than 4000) of the vertices of G , in counter-clockwise order. The next two lines describe polygon T and M , in the same format. It is guaranteed that G and T are outside each other (their boundaries will not touch), and are both inside M (they do not touch the boundary of M ). The last test case is followed by a single zero, which should not be processed.
输出解释
For each test case, print the case number and the minimal number of reflections to touch T . If it's impossible, output `-1'.
输入样例
4 4 12 
1 4 2 4 2 5 1 5 
6 4 7 4 7 5 6 5 
0 3 3 3 3 0 4 0 4 3 8 3 8 6 4 6 4 5 3 5 3 7 0 7 
4 4 4 
1 1 2 1 2 2 1 2 
3 1 4 1 4 2 3 2 
0 0 5 0 5 3 0 3 
4 4 4 
1 1 2 1 2 2 1 2 
6 1 7 1 7 2 6 2  
0 0 8 0 8 3 0 3
0
输出样例
Case 1: 2 
Case 2: 0 
Case 3: 1
来自杭电HDUOJ的附加信息
Recommend gaojie

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

源链接: HDU-2981

最后修改于 2020-10-25T22:58:53+00:00 由爬虫自动更新

共提交 0

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