QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 1024 MB 満点: 100

#2967. 打雪仗

統計

在我的那个年代,课间休息时我们被允许进行打雪仗。我和我的两个朋友分开,各自建造了一个堡垒,并储备了雪球。战斗开始后,我们向对方的堡垒投掷雪球,直到只剩下一个堡垒屹立不倒。那真是一段难忘的时光。

这里有三个堡垒,分别标记为 A、B 和 C,它们呈环形排列:B 在 A 的左侧,C 在 B 的左侧,A 在 C 的左侧。

堡垒的强度用非负整数表示。如果一个堡垒的强度为 0,那么它就变成了废墟,该堡垒里的人不再投掷雪球。

战斗按轮进行。每一轮中,每个处于非废墟状态的堡垒里的人都会选择一个目标。他们的目标是除自己堡垒外强度最高的堡垒。如果两个可选目标强度相同,则选择位于自己左侧的堡垒作为目标。随后,所有人同时向各自选择的目标投掷一个雪球。每个雪球使目标堡垒的强度减少 1。此过程重复进行,直到最多只剩下一个堡垒没有变成废墟。

给定三个堡垒的初始强度,请确定是否有一个堡垒没有变成废墟,如果有,输出该堡垒的名称及其剩余强度。

输入格式

输入包含一行,包含三个整数 $N_A$ ($1 \le N_A \le 10^{18}$),即堡垒 A 的初始强度;$N_B$ ($1 \le N_B \le 10^{18}$),即堡垒 B 的初始强度;以及 $N_C$ ($1 \le N_C \le 10^{18}$),即堡垒 C 的初始强度。

输出格式

如果所有堡垒都变成了废墟,输出 Rubble!。否则,输出 A、B 或 C,表示哪个堡垒留存了下来,并在其后输出该堡垒的剩余强度。

样例

输入 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!

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.