Given the submarine depth, jet height, horizontal distance and refraction indices, compute the laser elevation angle that hits the jet after refraction.
Medium5Binary searchMathNo attempts yetTime limit1sMemory limit256 MB
A submarine sends a message to a jet cruising overhead with a communications laser. The sea surface is flat. The submarine cruises at depth d below the surface. The jet is at height h above the surface and at horizontal distance x from the submarine. The submarine already turned toward the jet before starting communications, so the only thing left to settle is the angle of elevation ϕ at which to aim the laser.
When the laser passes from the sea into the air it is refracted, so its path bends. Snell's law describes the refraction. Light that reaches the flat surface at angle θ1 from the vertical leaves at angle θ2 from the vertical, and the two angles satisfy
sinθ2sinθ1=n2n1

θ1 is measured in the water and θ2 in the air, both from the vertical, and n1 and n2 are the refraction indices of the water and the air. The refraction index of a material is inversely proportional to how fast light travels through that material.
The angle of elevation ϕ is measured from the horizontal at the submarine.
The input consists of one or more datasets.
Each dataset is one line with five floating point numbers, in this order:
A line whose d is 0 ends the input. All five numbers on that line are 0 and the line is not a dataset.
For each dataset, print one line with the angle of elevation in degrees at which the submarine should aim its laser to illuminate the jet. Round the angle to the closest 1/100 of a degree and print exactly two digits after the decimal point.