当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2694:A Simple Poker Game

题目描述
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.
  • Four of a kind: 750 points four cards of the same rank accompanied by a "kicker", like 44442.
  • Full house: 500 points three cards of one rank accompanied by two of another, such as 777JJ.
  • Flush: 350 points five cards of the same suit, such as AJ942 of hearts.
  • Straight: 250 points five cards in sequence, such as 76543. Note that AKQJX is treated as a valid sequence.
  • Three of a kind: 200 points three cards of the same rank and two kickers of different ranks, such as KKK84.
  • Two pairs: 100 points two cards of one rank, two cards of another rank and a kicker of a third rank, such as KK449.
  • One pair: 50 points two cards of one rank accompanied by three kickers of different ranks, such as AAK53.
  • None of the above: O point any hand that does not qualify as one of the better hands above, such as KJ542 of mixed suits.

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.
输入解释
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.
输出解释
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

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Taiwan 2004

源链接: POJ-2694

最后修改于 2020-10-29T06:39:27+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536