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 ai, and the bottom contains number bi, then when the player is playing the card, he gets ai points and also gets the opportunity to play additional bi 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?

Comments

Popular posts from this blog