Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Language: Hands of Poker
Description The standard 52-card deck consists of 52 cards divided into 4 suits: clubs, diamonds, hearts and spades. For each suit there are 13 ranks: 2, 3, 4, 5, 6, 7, 8, 9, 10, jack, queen, king and ace, listed from the lowest to the highest.
A card is denoted by its rank (‘2’. . . ‘9’ for 2. . . 9, ‘T’ for 10, ‘J’ for jack, ‘Q’ for queen, ‘K’ for king, and ‘A’ for ace) followed by its suit (‘C’ for clubs, ‘D’ for diamonds, ‘H’ for hearts, and ‘S’ for spades). Cards are partially ordered by their ranks. The suit does not play a role in the cards ordering. A Poker hand is a set of five distinct cards. Each hand is said to have a certain ranking. A hand with a higher ranking beats a hand with a lower one. Two hands of the same ranking are compared using a tie-breaking rule specific for their ranking — either one of them beats the other or they are tied. The list of poker rankings is given below, from the worst ranking to the best ranking. If a hand satisfies several rankings, only the best one is considered.
Consider the set of all Poker hands. Let us introduce an evaluation function v : {1, . . . , 7462}, such that for any two Poker hands a and b, a beats b if and only if v(a) > v(b). There exists exactly one such evaluation function v. Given a Poker hand a, find the value of v(a). Input The input file contains space-separated list of five distinct card descriptions. Each card is described with two characters denoting its rank and suit, respectively. The ranks are denoted by ‘2’. . . ‘9’, ‘T’, ‘J’, ‘Q’, ‘K’, and ‘A’ (listed here in the ascending order). The suits are denoted by ‘C’, ‘D’, ‘H’, and ‘S’. Output Output the value of the evaluation function v(a) for the given hand a. Sample Input
Sample Output
Source |
[Submit] [Go Back] [Status] [Discuss]
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator