QOJ.ac

QOJ

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

#4315. 简单的卡牌游戏

統計

题目描述

Alice 和 Bob 最近玩了很多复杂的游戏,于是他们想玩点简单的游戏放松一下。

他们想起来有一种非常简单的游戏叫“憋七”,这种游戏只需要一副扑克牌就能玩。传统的“憋七”玩法稍微有点复杂,所以 Alice 和 Bob 打算玩一种简化版的“憋七”。

在游戏中用到的扑克牌包括黑桃(Spades)、红桃(Hearts)、梅花(Clubs)和方块(Diamonds)四种花色,每种花色的 1 点至 13 点各 1 张,共计 52 张牌。

简化版的游戏规则如下:

  1. 首先将一副 52 张的扑克牌平均分成两份,每份各 26 张,Alice 和 Bob 各拿一张;
  2. 拥有黑桃 7 的一方将手中的黑桃 7 置于场上;
  3. 接着,从另外一方开始轮流操作,每一轮玩家需要从自己持有的牌中挑选一张置于场上,可以打出的牌需要满足以下两个条件之一:
    • 这张牌的点数为 7;
    • 当前场上的牌中,有一张牌与将要打出的牌花色相同,点数恰好差 1。
  4. 如果当前进行操作的玩家不能按照规则打出一张牌,则判该玩家负,另一位玩家胜;否则,如果双方都打出了手上的所有牌,则判平局。

由于该游戏中不同花色的接龙是独立的,游戏时玩家常常将不同花色的 7 对成一竖排列,并在 7 的两侧接龙,将同花色的牌排成一行。

已知 Alice 和 Bob 都足够聪明。现在给出 Alice 和 Bob 的初始手牌,请计算当二人都按最优策略出牌时,游戏的结果。

输入格式

由于可以从一个人的手牌推断出另一个人的手牌,因此输入仅包含 Alice 的所有手牌。

输入仅一行,包括 26 个用空格隔开的字符串,每个字符串表示 Alice 手上的一张牌。

每张牌的输入格式为 花色 + 点数。其中,花色由一个字符表示,S 表示黑桃,H 表示红桃,C 表示梅花,D 表示方块;点数由对应的一位或两位的数字表示,数字最小为 1,最大为 13,均不含前导 0。例如,黑桃 7 对应字符串 S7

输出格式

输出仅一行,包括一个字符串,表示游戏的结果。如果 Alice 能赢得这局游戏则输出 Alice;如果 Bob 能赢得这局游戏则输出 Bob;如果平局则输出 Draw

样例数据

样例 1 输入

S4 S6 S11 S13 H3 H4 H5 H6 H8 H10 H12 C2 C4 C5 C6 C8 C9 C11 C13 D1 D4 D5 D6 D8 D10 D12

样例 1 输出

Bob

样例 2 输入

S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12 S13 D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13

样例 2 输出

Draw

样例 3 输入

H1 H2 H3 H4 H5 H6 H7 H8 H9 H10 H11 H12 C13 D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13

样例 3 输出

Alice

子任务

对于 $100\%$ 的数据,保证输入的牌符合输入格式中描述的格式,且输入的 26 张牌各不相同。

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.