Loading...
BlueBook - Direction
Time: 1 s
Memory: 125 MB
Given an integer N (0≤N<360), print out the closest compass bearing to that integer if N is the bearing in degrees. If there is a tie, print the "smaller" of the two possible outputs.
The bearings arranged in increasing order of "size" are: N, E, S, W. This means choose N over E if the input is 45∘, and N over W when the input is 315∘.
Input
The input consists of an integer T (1≤T≤1000), denoting the number of test cases and then each line following consists of one integer N.
Output
Output the closest compass bearing according to the input.
Examples
Input
Output
2
45
180
N
S
Problem Info
Problem ID 467
Time Limit 1000 ms
Memory Limit 128000 KB
Moderators pixelarco
Statistics
Submit
You need to Login or Registration for submit your solution