QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 64 MB Total points: 50

#13666. 凯撒

Statistics

小凯撒(Little Caesar)喜欢纸牌游戏。每次他来到萨格勒布(Zagreb),他都会和朋友们一起玩著名的纸牌游戏——21点(blackjack)。

在这个游戏中,玩家不断抽牌,直到手牌的点数之和大于 21,或者直到玩家说 “DOSTA”(克罗地亚语,意为“停止”)。

游戏开始时,牌堆中共有 52 张牌,包含四种花色,每种花色各有 13 个点数。牌的点数分别为:2、3、……、10、Jack(J)、Queen(Q)、King(K)和 Ace(A)。牌的面值如下:带数字的牌面值等于其数字(例如,“9”的面值为 9),花色牌(Jack、Queen 和 King)的面值均为 10,而 Ace 的面值为 11。

凯撒发现自己处于一个有趣的境地。在游戏过程中,他已经抽了 $N$ 张牌,其点数之和小于或等于 21,现在他正在犹豫是否再抽一张牌。假设 $X$ 是 21 与当前手牌点数之和的差值。大家都知道,如果牌堆中剩余的面值大于 $X$ 的纸牌数量大于或等于剩余的面值小于或等于 $X$ 的纸牌数量,就不应该再抽牌。

由于凯撒很难计算出自己是否需要再抽一张牌,他请求你帮他完成这个计算。

输入格式

输入的第一行包含一个正整数 $N$ ($1 \le N \le 52$),表示凯撒目前已经抽取的纸牌数量。

接下来的 $N$ 行,每行包含一个正整数,表示凯撒抽取的第 $i$ 张牌的面值。

输出格式

如果凯撒应该再抽一张牌,输出 “VUCI”(克罗地亚语,意为“抽牌”),否则输出 “DOSTA”(克罗地亚语,意为“停止”)。

样例

输入样例 1

6
2
3
2
3
2
3

输出样例 1

DOSTA

输入样例 2

1
10

输出样例 2

VUCI

输入样例 3

2
5
6

输出样例 3

VUCI

说明

样例 1 解释

已抽取的纸牌点数之和为 15,与 21 的差值 $X$ 为 6。牌堆中面值大于 6 的纸牌数量为 32(4 张 Ace、4 张 King、4 张 Queen、4 张 Jack、4 张 10、4 张 9、4 张 8 和 4 张 7),而牌堆中面值小于或等于 6 的纸牌数量为 14(1 张 2、1 张 3、4 张 4、4 张 5 和 4 张 6)。由于大于 6 的纸牌数量(32)大于或等于小于或等于 6 的纸牌数量(14),因此不应该再抽牌,输出 “DOSTA”。

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.