LCC/Moose '19 Contest 4 S1 - Sun Compass

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

A common piece of orienteering knowledge is that the time of day, position of the sun, and compass direction are all related: knowing the first two allows you to calculate the third.

To do this, one must note that sun’s compass angle changes roughly uniformly throughout the day. In the northern hemisphere, the sun is located due North (0 degrees) at midnight, due East (90 degrees) at 6am, due South (180 degrees) at noon, and due West (270 degrees) at 6pm. Hence, if you pick an arbitrary direction, measure the angle of the sun with respect to that direction, and subtract the angle of the sun with respect to North at the current time of day, you obtain the angle that North makes with that direction.

Given the angle of the sun with respect to some direction and the current time, find the angle that North makes with respect to that direction.

Input Specification

The input contains the sun angle A (0 \le A \le 359) and the time HH:MM in 24 hour format.

Output Specification

Output the angle of North, rounded to the nearest integer.

Sample Input 1

180 12:00

Sample Output 1

0

Sample Input 2

90 03:00

Sample Output 2

45

Comments

There are no comments at the moment.