Posts

Showing posts with the label Greedy

Playing Card Game

A player has several cards. Each card contains two non-negative integers inscribed, one at the top of the card and one at the bottom. At the beginning of the round the player chooses one of his cards to play it. If the top of the card contains number a i , and the bottom contains number b i , then when the player is playing the card, he gets a i points and also gets the opportunity to play additional b i cards. After the playing the card is discarded.The round ends when the counter reaches zero or the player runs out of cards. We want him to get as many points as possible. Can you determine the maximum number of points he can score provided that you know his cards?