### 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

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?

*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?

## Comments

## Post a Comment