시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 141 | 79 | 62 | 54.386% |
You are trapped in Jabba’s Palace. You have a coded map that describes the way out from your current location. The map contains a sequence of positive integers. Each integer corresponds to one of three directions (left, straight, right). To determine the direction you must convert the number into binary (base two with no leading 0s). If the binary number has more 0’s than 1’s go left. If the binary number has the same number of 0’s and 1’s go straight, and if it has more 1’s than 0’s go right. Your job is to read the sequence of positive integers and print the directions to find your way out.
Here are three example of converting positive (decimal) integers into binary and then into a direction.
Decimal | Binary | Direction |
---|---|---|
17 |
10001 |
left |
9 |
1001 |
straight |
22 |
10110 |
right |
A sequence of positive integers, one per line
The correct directions (left, straight, right) for escaping the Jabba’s Palace. You should write each move (left, straight, right) on a separate line with no extra lines.
17 7 4 9 22
left right left straight right