Under construction

Still being built. Things may change

Armageddon

Time limit1sMemory limit128 MB

Summary
Compute the time left before firing a missile can no longer deflect two asteroid pieces to miss Earth, given current distance, separation angle, and both speeds.
Level

Medium4 of 10

Topics
Math, Implementation, Geometry, Simulation
Solved
No attempts yet

Problem

An asteroid is heading straight for Earth. We can see only part of it — the rest is hidden behind the Sun — so its size and speed are unknown, and we must plan for the worst case.

Fortunately we have missiles. When a missile strikes the asteroid, the asteroid splits into two pieces that fly apart symmetrically, separating at a total angle of aa degrees. Each piece therefore leaves the asteroid's original line of flight at an angle of a/2a/2 and then travels in a straight line.

Earth is a circle of radius R=6378.1R = 6378.1 km centered at the origin. The asteroid travels straight toward the origin. We fire a missile from the point on Earth's surface nearest the asteroid (distance RR from the origin) straight along the asteroid's path; the missile moves at a constant speed, and the asteroid keeps its constant speed until impact.

If the missile strikes the asteroid while it is still at distance dd from the origin, the two pieces miss Earth exactly when d⋅sin⁡(a/2)≥Rd \cdot \sin(a/2) \ge R. Firing later means a smaller dd and less separation, so there is a last possible moment to fire. Given the asteroid's current distance, the separation angle, and the two speeds, report how many seconds remain before it is too late to fire.

Input

The first line contains the number of test cases KK. Each of the next KK lines describes one scenario with four numbers:

  • xax_a — the asteroid's distance from Earth's center in kilometers (xa>6378.1x_a > 6378.1),
  • aa — the angle in degrees at which the two pieces separate (0<a<1800 < a < 180),
  • sas_a — the asteroid's constant speed in kilometers per second (sa>0s_a > 0),
  • sms_m — the missile's constant speed in kilometers per second (sm>0s_m > 0).

Output

For each scenario, print Data Set x: on its own line, where xx is the scenario number starting from 11. On the next line print the number of seconds remaining before it is too late to fire, rounded to two decimal places. If less than 00 seconds remain, print Oh no! instead. Separate consecutive scenarios with a single blank line.

Examples1

  1. Example 1

    Input
    3
    63781.0 20.9514 6378.1 6378.1
    47835.75 15 6000 5000
    100000 30 3000 4000
    
    Expected output
    Data Set 1:
    0.00
    
    Data Set 2:
    Oh no!
    
    Data Set 3:
    20.55