ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

USU Internal Contest March'2001

About     Problems     Submit solution     Judge status     Standings
Contest is over

D. Darts

Time limit: 1.0 second
Memory limit: 64 MB
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.
  1. 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).
  2. 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.
  3. You may assume that the dart is thrown with a nonzero horizontal component (i.e. Vx or Vy is non-zero).
  4. You may assume no friction.
  5. To hit the dartboard the dart should hit it strictly inside boundary from any side.
  6. Initially the dart is not inside the dartboard's boundary.

Input

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 > 0.

Output

Output should contain the only word “HIT” if dart hits the dartboard, and word “MISSED” otherwise.

Sample

inputoutput
47 0 -72 1 0 1 4.25
0 0 0 10 0 10
HIT
Problem Author: Alexander Klepinin
Problem Source: USU Open Collegiate Programming Contest March'2001 Senior Session
To submit the solution for this problem go to the Problem set: 1093. Darts