Logo
(追記) (追記ここまで)

5370번 - Which Way 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB2081269957.558%

문제

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.

제한

예제 입력 1

17
7
4
9
22

예제 출력 1

left
right
left
straight
right

힌트

출처

School > PLU High School Programming Contest > PLU 2011 > Advanced 9번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /