#P8466. [Aya Round 1 A] 幻想乡扑克游戏

    ID: 9568 远端评测题 2000ms 512MiB 尝试: 0 已通过: 0 难度: 1 上传者: 标签>模拟洛谷原创Special JudgeO2优化洛谷月赛

[Aya Round 1 A] 幻想乡扑克游戏

Background

Problem Number: 22\textit{22}

After the Ability Card Incident, the girls of Gensokyo collected the extra cards and, imitating an outside game called “Dou Dizhu” (Dou Dizhu), played happily.

Problem Description

Dou Dizhu is a game played with a total of 5454 poker cards: A\tt A to K\tt K plus the small joker and the big joker. There is one small joker and one big joker, and for each other rank there are four cards. In Dou Dizhu, the order of card ranks is as follows:

$$\tt 3<4<5<6<7<8<9<10<J<Q<K<A<2<\stackrel{\mathclap{\color{white}\textbf{\textit{wxy}}}}{\text{小王}} < \text{大王}$$

Also, the rank order is unrelated to suits.

At the start of the game, 33 players are each dealt 1717 cards as their hand, and the remaining three cards become the bottom cards. Players will sort their cards from high to low, and then decide whether to call landlord based on how good their hand is.

You think that if your hand contains a “rocket” (i.e., one small joker and one big joker) or at least one “bomb” (i.e., four cards of the same rank), then you will choose to call landlord.

Please write a program to determine whether you should call landlord.

Input Format

This problem contains multiple test cases.

  • The first line contains an integer TT, the number of test cases.
  • The next TT lines each contain a string of length 1717, representing your hand. It is guaranteed that the cards have already been sorted. In the input, T\tt T represents a card of rank 10\tt 10, X\tt X represents the small joker, and D\tt D represents the big joker.

Output Format

  • Output TT lines in total.
  • For each test case, output one string per line:
    • yes means you should call landlord.
    • no means you should not call landlord.
  • You may output the string in any letter case. For example, yes, Yes, and YES are all accepted as meaning you should call landlord.
3
X2AAKKKKQT9765433
DX22AKKQJTT884443
X2AAAKQQJT8554433
Yes
Yes
No

Hint

Sample Explanation

For test case 11, the input corresponds to the following hand (ignoring suits):

There is a bomb in this hand:

So you choose to call landlord.

For test case 22, the input corresponds to the following hand (ignoring suits):

There is a rocket in this hand:

So you choose to call landlord.

For test case 33, the input corresponds to the following hand (ignoring suits):

There is no rocket and no bomb in this hand. So you choose not to call landlord.

Constraints and Notes

For 100%100\% of the testdata, 1T1041 \le T \le 10^4. It is guaranteed that the cards have already been sorted.

Translated by ChatGPT 5