#P4419. Little Caesar's Blackjack Decision
Little Caesar's Blackjack Decision
Little Caesar's Blackjack Decision
Little Caesar loves card games and when he visits Zagreb he always plays blackjack with his friends. In this game, a player draws cards while the total sum of his hand is less than or equal to 21, or until he decides to stop by saying DOSTA (Croatian for "STOP").
At the start, the deck contains 52 cards: for each of the four suits, there are thirteen ranks: two, three, four, five, six, seven, eight, nine, ten, Jack, Queen, King, and Ace. The values of the cards are as follows: cards with numbers are worth their corresponding number (e.g. nine is worth 9), the picture cards (Jack, Queen, and King) are each worth 10, and the Ace is worth 11.
Caesar has already drawn N cards with a total sum S ((S \le 21)). Let (X = 21 - S) be the remaining value before reaching 21. It is known that you should not draw another card if the number of remaining cards in the deck with a value greater than (X) is greater than or equal to the number of cards with a value less than or equal to (X). Your task is to help Caesar decide whether he should draw another card or not. If he should draw, print VUCI, otherwise print DOSTA.
inputFormat
The input consists of two lines. The first line contains an integer N (the number of cards Caesar has drawn). The second line contains N space-separated strings representing the ranks of the drawn cards. The possible card names are: two, three, four, five, six, seven, eight, nine, ten, Jack, Queen, King, Ace.
outputFormat
Print a single line with the answer: print DOSTA if Caesar should stop drawing cards, or VUCI if he should draw another card.
sample
2
two three
VUCI