#d2453. 德州扑克牌型判定
德州扑克牌型判定
Texas Hold'em Poker Hand Evaluation
Problem Description
Given the rank and suit of playing cards, determine the strongest poker hand these cards can form.
To guarantee a valid input, the following are assumed:
- All cards come from the same standard deck of playing cards;
- The input ranks are given in non-decreasing order;
- Suits have no ordering among themselves.
The hand types (from strongest to weakest) are defined as follows:
- ROYAL FLUSH: five cards with consecutively increasing ranks, all of the same suit, and whose highest card is an (Ace);
- STRAIGHT FLUSH: five cards with consecutively increasing ranks, all of the same suit;
- FOUR OF A KIND: at least four cards share the same rank;
- FULL HOUSE: at least three cards share the same rank, and the remaining two cards also share the same rank;
- FLUSH: all five cards are of the same suit;
- STRAIGHT: five cards with consecutively increasing ranks, not requiring the same suit;
- If the strongest possible hand is no better than THREE OF A KIND, output
FOLD(fold).
Mapping between ranks and input numbers:
- correspond to ;
- (Jack) corresponds to , (Queen) corresponds to , (King) corresponds to , (Ace) corresponds to .
Mapping between suits and input numbers:
- Spades correspond to ;
- Diamonds correspond to ;
- Hearts correspond to ;
- Clubs correspond to .
Input Format
Two lines, each containing integers. The -th number in the first line is the rank of the -th card (guaranteed non-decreasing); the -th number in the second line is the suit of the -th card (guaranteed valid).
Output Format
Output the strongest hand these five cards can form, which is one of: ROYAL FLUSH, STRAIGHT FLUSH, FOUR OF A KIND, FULL HOUSE, FLUSH, STRAIGHT, FOLD (without quotes).
Sample Input 1
10 11 12 13 14
1 1 1 1 1
Sample Output 1
ROYAL FLUSH
Sample Input 2
10 11 12 13 14
1 2 1 3 4
Sample Output 2
STRAIGHT
Sample Input 3
6 6 6 7 7
1 2 3 1 3
Sample Output 3
FULL HOUSE
Sample Input 4
3 3 6 6 9
1 2 1 2 1
Sample Output 4
FOLD