← 返回 rippling 的题目列表Camel Cards Hand Ranking (with Jokers or Variants)
类型:online_judge
Problem: Camel Cards Hand Ranking and Scoring
You are given multiple 5-card hands and their associated bids. Rank the hands using specific hand-type rules, then compute a final total score.
Typical Interview Version
Each input line: HAND BID
HAND is a length-5 string over {2-9, T, J, Q, K, A} (a common variant treats J as a Joker/wildcard).
BID is a positive integer.
Implement:
A hand-strength evaluation (e.g., five-of-a-kind, four-of-a-kind, full house, three-of-a-kind, two pair, one pair, high card).
Tie-breaking within the same type by comparing card ranks left-to-right (position 1 to 5).
Sort all hands from weakest to strongest (or as specified). The i-th hand (1-indexed) contributes i * bid.
Output the sum.
Clarifications You Must Handle
Is J a normal rank or a Joker? If Joker, how does it maximize the hand type and affect tie-break ordering?
Rank mapping of cards (A highest, 2 lowest; with Joker rules, J may be treated as lowest).
Input size N and performance needs (usually O(N log N) sorting is enough).
Example (Illustrative)
32T3K 765
T55J5 684
KK677 28
KTJJT 220
QQQJA 483
Output:
<total_score>
(This is commonly adapted from Advent of Code 2023 Day 7 "Camel Cards".)
Example
Input
32T3K 765
T55J5 684
KK677 28
KTJJT 220
QQQJA 483
Output
<depends on whether J is joker; output total score>