Not an official ACM page
[Problem G | 1993 East-Central Regional problem set | My ACM problem archive | my home page]

## Of(f) Course!

Fat Chance Airlines has had several of their aircraft stray o course within the last few months. After the last error nearly put an aircraft over the enemy's airspace, an investigation has shown that their navigation techniques do not take the wind speed and direction into account properly. In order to make life easier on their novice navigators, the airline has contracted with your team to produce a program that will provide the pilot with the proper heading for the aircraft, given a desired course and wind velocity.

For each flight segment, you will be given the desired course, the true air speed (the speed relative to the air) of the aircraft, the wind speed, and the direction the wind is blowing from. The pilot needs the heading to which she should steer the aircraft and the effective ground speed (the speed at which the aircraft is moving over the desired course relative to the ground). All speeds will be given in knots, and all directions will be given in degrees (0° <= X < 360°, with 0°= NORTH, 90° = EAST, 180 = SOUTH, 270° = WEST).

Input to your program will consist of a series of ight segments, one per line terminated by an end-of-file. Each line will consist of the wind speed, the wind direction, the desired course, and the true air speed, all given as free-format oating point numbers separated from each other by a single space.

Your program should produce for every line segment in the input file, including the last one, six lines followed by a blank line. Each of the six lines is labeled as in the example below. The first four lines reproduce the input numbers. The remaining two lines show the heading and e ective ground speed calculated for each segment. Use a format analogous to the sample below. Each number must be accurate to 1/100th.

### Sample Input

```15.0 290.0 260.0 100.0
15.0 270.0 135.0 200.0
28.0 290.0 5.0 195.0
```

### Sample Output

```WIND SPEED 15.00
WIND DIRECTION 290.00
DESIRED COURSE 260.00
TRUE AIRSPEED 100.00
GROUND SPEED 86.73

WIND SPEED 15.00
WIND DIRECTION 270.00
DESIRED COURSE 135.00
TRUE AIRSPEED 200.00