Type: Default 1000ms 256MiB

假币问题

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

有 1212 枚硬币 A∼L\texttt A \sim \texttt L,其中有 11 枚是假币。

假币和真币重量不同,但不知道假币比真币重还是轻。

现在用一架天平秤 33 次,告诉你结果:

  1. up\texttt{up}:右边高;
  2. down\texttt{down}:右边低;
  3. even\texttt{even}:平衡。

保证天平左右硬币个数总是相等。

输入格式

本题在单测试点内有多组测试数据。

第一行一个正整数 nn 表示测试数据组数。

接下来的 3n3n 行,每行 33 个字符串,分别是天平左侧的硬币编号、右侧的硬币编号和是否平衡(在【题目描述】中有提到)。每 33 行为一组测试数据。

输出格式

共 nn 行,每一行输出哪一枚是假币,并说明它比真币轻还是重。

  • 若轻输出 XXX is the counterfeit coin and it is light.
  • 若重输出 XXX is the counterfeit coin and it is heavy.

样例 #1

样例输入 #1

1
ABCD EFGH even
ABCI EFJK up
ABIJ EFGH even

样例输出 #1

K is the counterfeit coin and it is light.
3
ABCD EFGH even
ABCI EFJK up
ABIJ EFGH even
ABCD EFGH up
ABCD EFJK even
ABID EFJH up
ABHD EFKI down
ABCI EFJL even
ABKD HJLC down
K is the counterfeit coin and it is light.
H is the counterfeit coin and it is light.
D is the counterfeit coin and it is light.

模拟

Not Claimed
Status
Done
Problem
8
Open Since
2024-6-24 0:00
Deadline
2024-7-31 23:59
Extension
24 hour(s)