Maybe you know about the game called Darts. The goal of the game is to hit a circular target, which is called a dartboard. To do so you should take a dart and throw it to the dartboard. Of course, it takes time to learn how to hit the dartboard. And your task is to speed the learning by writing a program that determines if a dart will hit or miss the dartboard.
Let's make some assumptions about the objects under consideration.
- A dartboard is a circular part of a plane. It is defined by coordinates of its center (Cx, Cy and Cz), radius R, and coordinates of a vector that is orthogonal to the plane of the dartboard (Nx, Ny and Nz).
- A dart is a point that moves according the following equations:
Mx = Sx + Vx·t
My = Sy + Vy·t
Mz = Sz + Vz·t − (g/2)·t2
Here Sx, Sy, and Sz are coordinates of initial position of the dart, Vx, Vy, and Vz are components of initial velocity of the dart, Mx, My, and Mz are coordinates of the point where the dart will be at time t, g is the acceleration of gravity and is assumed to be equal to 10.
- You may assume that the dart is thrown with a nonzero horizontal component (i.e. Vx or Vy is non-zero).
- You may assume no friction.
- To hit the dartboard the dart should hit it strictly inside boundary from any side.
- Initially the dart is not inside the dartboard's boundary.
Input contains 13 real numbers. They are (according to notation given before):
Cx Cy Cz Nx Ny Nz R
Sx Sy Sz Vx Vy Vz
All numbers are not greater than 500 in their absolute values and given with at most 4 digits after decimal point. R is positive.
Output should contain the only word "HIT" (without quotes) if dart hits the dartboard, and word "MISSED" otherwise.
47 0 -72 1 0 1 4.25
0 0 0 10 0 10
Problem Author: Alexander Klepinin
Problem Source: USU Open Collegiate Programming Contest March'2001 Senior Session