Advertisement
ErolKZ

Untitled

Nov 9th, 2021
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. Card Game
  2.  
  3. You are given a sequence of people and for every person what cards he draws from the deck. The input will be array of strings. Each string will be in the format:
  4.  
  5. {personName}: {PT, PT, PT,… PT}
  6.  
  7. Where P (2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A) is the power of the card and T (S, H, D, C) is the type. The name can contain any ASCII symbol except ':'. The input will always be valid and in the format described, there is no need to check it.
  8.  
  9. A single person cannot have more than one card with the same power and type, if he draws such a card he discards it. The people are playing with multiple decks. Each card has a value that is calculated by the power multiplied by the type. Powers 2 to 10 have the same value and J to A are 11 to 14. Types are mapped to multipliers the following way (S -> 4, H-> 3, D -> 2, C -> 1).
  10.  
  11. Finally print out the total value each player has in his hand in the format:
  12.  
  13. {personName}: {value}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement