编程介的小学生 2017-12-05 08:15 采纳率: 20.5%
浏览 810
已采纳

Elune’s Arrow

Problem Description
In a recent DOTA game, Littlepig picked Priestess of the Moon (also been called as “POM”) and wanted to practice his skills. As you may know, POM is famous for her second skill “Elune’s Arrow”, which allows POM to fire a fast magic arrow to deal large damage to the enemy unit. In fact, POM’s arrow always flies in a straight line and disappear after hitting an enemy unit.

Littlepig’s POM was hiding in the forest and intended to shoot a certain important target on the lane. There were also several other enemy units nearby. POM’s arrow might fly in a wrong direction and miss the target, or even if the arrow flew straight to the target, it still could be blocked by other enemy units and couldn’t reach the target. So given a flying direction, your job is to determine whether Littlepig’s arrow would hit his target.

Input
The input contains several test cases, and each test case is given in the following format:
The first line contains an integer n (0 <n<=5), indicating the number of enemy units in the game.
The second line are two integers (x0,y0) representing the position where POM stands.
The third line gives a vector (dx,dy) describing the flying direction of the arrow.
Then n lines follows, each describing an enemy unit. An enemy unit can be considered as a convex polygon and the polygon is given in the following format in a line:
m x1 y1 x2 y2…xm ym
m is the number of vertices(m<=10), and (x1,y1)…(xm,ym) are the vertices coordinates of the polygon, given in counter-clockwise order.
The first enemy unit is the POM’s target.

The input ends with a zero in a separate line (n=0). All input numbers are integers that do not exceed 105 in magnitude. It is guaranteed that polygons do not contact or overlap, and the point (x0,y0) isn’t inside (or on) any polygons.

Output
For each test case, output “HIT” if the arrow hits its target and “MISS” otherwise, in a separate line.

Sample Input
1
0 0
0 1
3 2 0 0 2 0 1
1
0 0
-1 -1
3 2 0 0 2 0 1
0

Sample Output
HIT
MISS

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-12-10 16:17
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?