You are tasked with planning a flying route for a local airplane delivery company. You need to route an airplane from point A to point B. You just can't start at A, point the airplane at B, and go, however, as the prevailing winds will blow you off course. Instead you need to figure out which direction you should point the airplane so that it will fly directly to B, taking the wind into account.
input
7 floating-point numbers, encoding A_x, A_y, B_x, B_y, S, W_x, W_y. These are the coordinates of your start and destination, the airspeed of your airplane, and the strength of the wind along the x and y axes (the direction the wind blows to, not from).
output
You should print the angle in degrees (rotating counterclockwise from the positive x axis) that the plane should point to reach B in a straight line. Print GROUNDED
if the wind is so strong as to make the trip impossible.
You may round to the nearest degree, and do so with any method you would like (up/down/nearest/...).
examples
inputs
0 0 10 0 100 0 -50
0 0 10 0 50 -55 0
3.3 9.1 -2.7 1.1 95.0 8.8 1.7
outputs
30
GROUNDED
229
Shortest code wins.
a sin x + b cos x = c
on Google for some methods of solving your equation. Direct solving may not be the best way to go here, though... \$\endgroup\$ – Keith Randall May 6 '11 at 21:17