| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 (추가 시간 없음) | 1024 MB | 95 | 60 | 41 | 56.164% |
You have been challenged by the infamous magician Zhivago to his signature coin game! The game starts off with a pile of $n$ coins, where you and Zhivago will each take turns grabbing coins from the pile, and the loser is the one that grabs the last coin. Each player has to take 1ドル,ドル 2ドル$ or 3ドル$ coins each turn; no more, no less!
Zhivago is a master in his own game, and will always play optimally. However, you have been informed that you are in a winning position, and can best Zhivago to become the coin game champion. Can you do it?
First, your program should read a single integer $ 1 \leq n < 1000,ドル the number of coins in the pile at the start of the game. Then, we repeat the following process:
I give up" instead. At this point your program should terminate.After making each move, do not forget to flush the output. To do this, use:
fflush(stdout) or cout.flush() in C++;System.out.flush() in Java;stdout.flush() or print(output, flush=True) in Python;| Your output | Zhivago output | Interpretation |
|---|---|---|
7 |
There are $ n = 7 $ coins as the starting amount in the pile. | |
2 |
1 |
You take 2ドル$ coins and Zhivago responds by taking 1ドル$ coin. |
3 |
I give up |
You take 3ドル$ coins. Since there is only 1ドル$ coin left, Zhivago gives up. |
Contest > Bergen Open > Bergen Open 2021 C번