# Problem 1109. USC Spring 2012 ACM: Armageddon

This Challenge is to solve Question E, Armageddon, of the USC ACM Spring 2012 Contest.

An asteroid has been detected that will traverse the center of the earth if it is not deflected. The Splitter missile will bisect the asteroid with an included angle (>0, <180 degrees), based on its composition. The asteroids distance(to center of earth), velocity, and split angle will be provided. The Splitter missile velocity is also provided. Launch occurs from the earth surface nearest the asteroid. Miscellaneous details: Earth Radius 6378.1 km, velocities in km/sec, distance in km , and angle in degrees.

Return the Maximum Time Prior to Launch, nothing hitting the earth, to two decimal places.

Input: [ Asteroid Distance, Angle of Split, Asteroid Velocity, Missile Velocity ]

Output: [Maximum Time Prior to Launch]; if too late return -1;

The full USC data file

Example:

Input: 63781.0 20.9514 6378.1 6378.1

Output: 0.00 as immediate Launch is required

Input 47835.75,15,6000,5000 returns -1.

Geometry Hint: Draw a circle and a line from the center of approximately 2 radius. Take a ruler pivoting from the end of the line and rotate the ruler until it touches the circle.

### Solution Stats

65.0% Correct | 35.0% Incorrect
Last Solution submitted on Jul 02, 2018

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!