QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#16548. 游戏

統計

题目描述

小 C 和小 D 正在玩一款蒸蒸日上的游戏。

这款游戏共有 $3$ 种手牌:杀、闪、斩。他们的用途分别如下:

  • 杀:对对方使用,对方需要使用一张,否则对方输掉游戏;回应对方的
  • 闪:回应对方的
  • 斩:对对方使用,对方需要使用一张,否则对方输掉游戏。

玩家在每使用一张牌后,都需要弃掉该使用的牌。

从小 C 开始,每个回合依次属于小 C 和小 D。在玩家的回合内,该玩家可以出任意,对方需要做出对应的回应。当然,玩家也可以不出牌,直接进入对方的回合。

现在,小 C 共有 $c_1$ 张杀、$c_2$ 张闪、$c_3$ 张斩,小 D 共有 $d_1$ 张杀、$d_2$ 张闪、$d_3$ 张斩,双方都知道对方的手牌。你需要求出,双方在都进行最优策略的情况下,游戏的结果会如何。

输入格式

本题有多组测试数据。

第一行输入一个整数 $T$,表示测试数据组数。

接下来依次输入每组测试数据,对于每组测试数据,输入一行六个整数 $c_1,c_2,c_3,d_1,d_2,d_3$。

输出格式

对于每组测试数据,输出一行:

  • 若双方在都进行最优策略的情况下,小 C 可以获胜,则输出 C
  • 若双方在都进行最优策略的情况下,小 D 可以获胜,则输出 D
  • 若双方在都进行最优策略的情况下,游戏会平局,即谁也无法获胜,则输出 E

样例 1 输入

3
3 1 4 1 5 9
1 1 4 5 1 4
5 2 1 2 6 3

样例 1 输出

C
D
E

样例 1 解释

对于第一组数据,小 C 可以先出一张斩,并在小 D 回应一张杀后再出一张斩。此时小 D 的杀用完了,无法做出回应,输掉了游戏。

样例 2

见附加文件中的 game/game2.ingame/game2.ans

数据范围

对于 $100\%$ 的数据,$1 \le T \le 10^5$,$0 \le c_1,c_2,c_3,d_1,d_2,d_3 \le 10^9$。

测试点编号 特殊性质
$1\sim3$ 保证 $c_3=d_3=0$
$4\sim6$ 保证 $c_1=d_2$ 且 $c_2=d_1$
$7\sim10$

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.