2018-2019 CTU Open Contest |
---|
Закончено |
Binary Casino has established a new department to attract families with children. One of its first tasks is to design a game for children which will be not so difficult to play. The result of a week of hard work is a game called Rullete (sic!).
Each player gets a hand of 5 cards. Cards in the hand are ordered as first, second, ..., fifth. Each card is described by a rank and a suit. Card's rank can be one of 2, 3, ..., 10, J, Q, K, A and its suit can be one of D, H, C, or S (Diamonds, Hearts, Clubs, or Spades). Cards $$$2$$$ through $$$10$$$ have scores equal to their rank and cards $$$\mathrm{J}$$$, $$$\mathrm{Q}$$$, $$$\mathrm{K}$$$, and $$$\mathrm{A}$$$ all have a score of $$$10$$$. Initially, a player's hand has a value given by the sum of scores of the cards in his hand. The initial hand value is then changed according to the rules of the game. To make croupier's life easier, your task is to calculate the final value of you hand of cards after all of the following fourteen rules are applied in the given order:
A straight is a set of any 5 consecutive cards in the following order: 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A.
Input consists of a single line with five space-separated card descriptions, each containing the card rank immediately followed by its suit.
Output the score after applying all of the rules.
2D 5D JD KC AC
170
QC 8D JD 10S 9D
126
Название |
---|