#P2694. A Simple Poker Game
A Simple Poker Game
Description
A software company wants to write a program to play a simple poker game. In the game, a player is given a hand, namely 5 distinct poker cards, from a deck of 52 distinct cards. A deck of 52 cards consists of 4suits of 13 cards each, coded and sequenced as A, 2, 3, 4, 5, 6, 7, 8, 9, X,J, Q, and K. The 4 suits are club (C), heart (H), spade (S), and diamond(D).
You tasks is to write a program to determine the points of a hand of 5cards using the following scoring rules:
- Straight flush: 1000 points five cards of the same suit in sequence, such as 76543 of hearts. Note that AKQJX is treated as a valid sequence.
Note that if a hand satisfies two or more rules above, then we only apply the rule that wins the largest amount of points. For example, a "full house" consists of a "three of a kind" and a "one pair." You need to give
the score for "full house" only (i.e., 500 points), and nothing else.
Input
The first line contains the number of hands w, w <= 100. Then the w hands are listed one by one. Note that each hand comes from a complete deck of52 cards. Each hand is listed in one line with 5 cards. Each card consists of two upper case letters. The first letter is its suit, and the second letter is its rank. There is a blank between two cards. The cards in one hand are not sorted at all.
Output
For each hand, output its points in one line.
3
C3 D4 D5 S3 CX
CA C5 D4 D3 S2
HA HJ HX HQ HK
50
250
1000
Source
Taiwan 2004