아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Snowball Fight

시간 제한1초메모리 제한1024 MB

요약
원탁에 놓인 세 요새가 서로 눈덩이를 던지는 싸움을 하나만 남을 때까지 진행하고, 살아남은 요새와 남은 강도를 구합니다. 강도는 최대 10^18입니다.
난이도

보통10점 중 6점

유형
시뮬레이션, 수학
정답자
아직 제출이 없습니다

문제

\textit{Back in my day, we were allowed to have snowball fights during recess. Me and my two friends would split up, build a fort, and stock it with snowballs. When the fighting started, we threw snowballs at each other's forts until there was one left standing. Those were the days.}

There are three forts labelled A, B, and C that appear in a circle: with B to the left of A, C to the left of B, and A to the left of C.

The strengths of the forts are represented as nonnegative integers. If the strength of a fort is 00, then it is just rubble and the person in that fort no longer throws snowballs.

The fight proceeds in rounds. Each round, each person in a non-rubble fort picks a target. Their target is the fort with highest strength, apart from their own. If both possible targets have the same strength, the person chooses the fort on their left as the target. The people then simultaneously throw a single snowball at their chosen target. Each snowball reduces the strength of the target fort by 11. This repeats until there is at most one fort that is not reduced to rubble.

Given the initial strengths of the three forts, you are to determine if there is a fort that is not reduced to rubble and, if so, the remaining strength of that fort.

입력

Input contains a single line containing three integers N_AN\_A (1≤N_A≤10181 \leq N\_A \leq 10^{18}), which is the initial strength of fort A, N_BN\_B (1≤N_B≤10181 \leq N\_B \leq 10^{18}), which is the initial strength of fort B, and N_CN\_C (1≤N_C≤10181 \leq N\_C \leq 10^{18}), which is the initial strength of fort C.

출력

If all forts are reduced to rubble, display Rubble!. Otherwise, display A, B, or C indicating which fort was left standing followed by the remaining strength of that fort.

예제9

  1. 예제 1

    입력
    10 3 1
    
    예상 출력
    A 3
    
  2. 예제 2

    입력
    3 2 1
    
    예상 출력
    Rubble!
    
  3. 예제 3

    입력
    2 3 2
    
    예상 출력
    C 1
    
  4. 예제 4

    입력
    100 101 100
    
    예상 출력
    A 1
    
  5. 예제 5

    입력
    100 99 100
    
    예상 출력
    Rubble!
    
  6. 예제 6

    입력
    1000 5000 1000
    
    예상 출력
    B 1001
    
  7. 예제 7

    입력
    2000 1000 1000
    
    예상 출력
    C 1
    
  8. 예제 8

    입력
    1000000000000000 2000000000000000 4000000000000000
    
    예상 출력
    B 1
    
  9. 예제 9

    입력
    1000000000000000 2000000000000000 4000000000000001
    
    예상 출력
    Rubble!