시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB333100.000%

문제

\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 $0$, 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 $1$. 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_A$ ($1 \leq N_A \leq 10^{18}$), which is the initial strength of fort A, $N_B$ ($1 \leq N_B \leq 10^{18}$), which is the initial strength of fort B, and $N_C$ ($1 \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.

예제 입력 1

10 3 1

예제 출력 1

A 3

예제 입력 2

3 2 1

예제 출력 2

Rubble!

예제 입력 3

2 3 2

예제 출력 3

C 1

예제 입력 4

100 101 100

예제 출력 4

A 1

예제 입력 5

100 99 100

예제 출력 5

Rubble!

예제 입력 6

1000 5000 1000

예제 출력 6

B 1001

예제 입력 7

2000 1000 1000

예제 출력 7

C 1

예제 입력 8

1000000000000000 2000000000000000 4000000000000000

예제 출력 8

B 1

예제 입력 9

1000000000000000 2000000000000000 4000000000000001

예제 출력 9

Rubble!

출처

ICPC > Regionals > North America > Rocky Mountain Regional > 2021 Rocky Mountain Regional Contest J번

  • 문제를 만든 사람: Zachary Friggstad