## COCI '17 Contest 1 #1 Cezar

View as PDF

Points: 3
Time limit: 1.0s
Memory limit: 64M

Problem type

Little Caesar likes card games. Every time he comes to Zagreb, he plays blackjack, the famous card game, with his friends.

In this game, the player draws cards while the sum of the cards in his hand is less than or equal to or until he says DOSTA (Croatian for "STOP").

At the beginning of the game, there are cards in the deck, thirteen ranks of each of the four suits. The card ranks are two, three, …, ten, Jack, Queen, King and Ace. The card values are the following: the cards with numbers on them are worth that number (e.g., "nine" is ), the cards with pictures (Jack, Queen, and King) are worth , whereas the Ace is worth .

Caesar has found himself in an interesting situation. During the game, he already drew cards whose sum is less than or equal to and is now having second thoughts about drawing one more card or not. Let's assume is the difference from the sum of the cards so far to . Everybody knows that you don't draw a card if the number of the remaining cards in the deck whose value is greater than is greater than or equal to the number of the remaining cards in the deck whose value is less than or equal to .

Since Caesar is having a difficult time calculating whether he needs to draw another card or not, he's asking you to do it for him.

#### Input Specification

The first line of input contains the positive integer , the number of cards Caesar has drawn so far.

Each of the following lines contains a single positive integer, the value of the card Caesar drew.

#### Output Specification

If Caesar should draw another card, output VUCI (Croatian for "DRAW"), otherwise output DOSTA (Croatian for "STOP").

#### Sample Input 1

6
2
3
2
3
2
3

#### Sample Output 1

DOSTA

#### Sample Input 2

1
10

#### Sample Output 2

VUCI

#### Sample Input 3

2
5
6

#### Sample Output 3

VUCI

#### Sample Explanation

The sum of the already drawn cards is and the difference to is . The number of cards in the deck with a value greater than is ( Aces, Kings, Queens, Jacks, tens, nines, eights, and sevens), whereas the number of cards in the deck with a value less than or equal to is ( two, three, fours, fives, and sixes).

• commented on June 19, 2022, 5:43 p.m. edited

Quote: "In this game, the player draws cards while the sum of the cards in his hand is less than or equal to 21".
Wait...if the sum is equal to 21, then the player won, right? No need to draw any more cards, riiight?!

Or is Croatian Black Jack somehow different?

• commented on June 2, 2022, 10:01 p.m.

I have cleared all test batches except test batch2 ..any clue where i'm having problem.

• commented on March 29, 2022, 9:36 p.m.

I have been trying this one for a while. Perhaps I'm not understanding something? Anyone able to offer up a clue based on my latest submission?

• commented on March 29, 2022, 9:54 p.m.

An ace is an 11, not a 13

• commented on March 30, 2022, 12:22 p.m.

Oh man.. thank you for pointing that out!!! It's funny when you see the issue that has been tripping you up.. I guess I must have counted it as 13 as it was the 13 card... 2,3,4,5,6,7,8,9,10,j,q,k,a... its embarrassing(smacks head).. lol cheers.

• commented on Dec. 28, 2021, 8:58 a.m. edited

I have reached the end of my tether with this problem. Can anyone give me a hint and point out where I am going wrong?

Edit: The editorial made me take a slightly different approach, which worked. Unfortunately, I don't know why!