Anti-missile intercept
Time limit2sMemory limit512 MB
Given the missile parabola and the anti-missile launch point and speed, decide the firing time and angle that intercepts at time tK, or report failure.
- Level
Medium4 of 10
- Topics
- Geometry, Math, Implementation
- Solved
- No attempts yet
Problem
You have to write software that shoots down a missile fired by the enemy. The situation is modeled as a simple two dimensional plane. The enemy launches its missile from on the axis, and you launch your anti-missile from . All lengths are in feet.
At the moment of launch the enemy missile has velocity in the direction and in the direction, in feet per second. The missile is launched at time , so at any later time it is at
The image below draws one possible pair of trajectories. The missile follows a parabola and the anti-missile follows a straight line. In this picture is negative. is always positive.

Your commanders want the missile destroyed at a specific time . Work out when to fire your anti-missile and what launch angle to use, so that it meets the missile at exactly that time. You are also given , the speed of your anti-missile along its straight trajectory.
Sometimes the missile cannot be destroyed at time . It cannot be destroyed if either of the following holds.
- You would have to fire the anti-missile before time , that is, the launch time is negative.
- The height of the missile at time is or less, so it has already landed and blown up.
In that case the software sounds an alarm so that everyone can start running.
Input
One line holds six integers , , , , , , separated by spaces, where , , and .
Output
If the missile cannot be destroyed at time , print start running.
Otherwise print the launch time and the launch angle on one line, separated by a single space. Round both values to exactly eight digits after the decimal point and print all eight digits.
is in degrees, measured counterclockwise from the positive direction, and always satisfies .