RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
R03572

J3. Secret Instructions

Unrated 레이팅 미적용
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Professor Santos has decided to hide a secret formula for a new type of biofuel. She has, however, left a sequence of coded instructions for her assistant.
Each instruction is a sequence of five digits which represents a
direction to turn and the number of steps to take.

The first two digits represent the direction to turn:

  • If their sum is odd, then the direction to turn is left.

  • If their sum is even and not zero, then the direction to turn is
    right.

  • If their sum is zero, then the direction to turn is the same as
    the previous instruction.

The remaining three digits represent the number of steps to take
which will always be at least 100.

Your job is to decode the instructions so the assistant can use them
to find the secret formula.

제약
입력 형식

There will be at least two lines of input. Each line except the last
line will contain exactly five digits representing an instruction. The
first line will not begin with 00. The last line will contain 99999 and no other line will contain 99999.

출력 형식

There must be one line of output for each line of input except the last line of input. These output lines correspond to the input lines (in order). Each output line gives the decoding of the corresponding
instruction: either right or
left, followed by a single space, followed by the number of steps to be taken in that direction.

예제 1
입력
57234
00907
34100
99999
출력
right 234
right 907
left 100
설명

The first instruction is 57234 which is decoded as right 234 because \(5 + 7 = 12\) which is even and
57 is followed by
234.

The second instruction is 00907 which is
decoded with the same direction as the previous instruction
(right) but with 907
steps.

The third instruction is 34100 which is decoded as left 100 because \(3 + 4 = 7\) which is odd and
34 is followed by
100.

The last line contains 99999 which tells us these are the only three instructions.

문제 정보

생성자가 기록되지 않았습니다.

출처 CCC 2021 Junior

평가 및 의견

J3. Secret Instructions

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

J3. Secret Instructions

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8