Thers Kownn Card Game Called 14 S Played 52 Cards Deck Https Enwikipediaorg Wiki Standard Q43798390
thers kownn card game called 14 . It’s played with 52 Cards Deckhttps://en.wikipedia.org/wiki/Standard_52-card_deck with 2, 3 or 4Jokers.
At the start of the game, each player will have 14 cards. Eachcard has a certain value. The value of a number card is the numberitself. The King, the Queen, the Jack and the Ace values arecounted as the value of 10 . Each turn, a player must take a newcard and throw a useless card. The player might choose to reveal aset of cards from his hand. To reveal a set, :
- The sum of values of the set must be >=51.
- The set consist of subsets. Each subset size is at least 3cards and at most 5 cards.
- A subset must assembled of a successive cards from the samecolor, or different color cards of the same value.
- The Ace can be placed before the 2 and 3 or after the Queen andthe King.
Your task is simple. Given a set of 15 cards, what is themaximum set sum the can be assembled ?
Input Format
An integer T represent the number of test cases, then T testcase follow.
Each test case consist of two lines described as follows:
-
The First line will contain 15 separated characters. 2 – 10 forthe numbers cards , A for the Ace , K for the King, Q for the Queenand J for the Jack.
-
The Second line will contain 15 separated characters of the set{c,d,h,s} for Clubs, Diamonds, Hearts and Spades,respectively.
Constraints
No joker will be added
Output Format
For each test case print the value of the maximum set sum can beassmbled. If the sum is print .
Sample Input 0
13 4 3 4 5 9 A J 2 7 Q 2 K 10 8c c d s h d d h c d h d h d d
Sample Output 0
88
Explanation 0
The subset are as follows:
- {Kh,Qh,Jh} = 30
- {Ad,2d,3d} = 15
- {10d,9d,8d,7d} = 34
- {2c,3c,4c} = 9
Hence the sum is 88
using java or c++ or python
Expert Answer
Answer to thers kownn card game called 14 . It’s played with 52 Cards Deck https://en.wikipedia.org/wiki/Standard_52-card_deck wit…
OR