| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 19 | 9 | 8 | 53.333% |
Two players, Anda and Kamu, want to play a game. Initially, there is an integer $N$ that consists of only non-zero digits. Anda and Kamu will take turns alternatingly starting with Anda.
During one turn, the player of that turn must do the following procedure: First, choose three consecutive digits in $N$ such that if the digits are considered as a three-digit integer, it must be divisible by $3$. Then, erase the middle digit of the chosen digits and concatenate the rest, so the number of digits in $N$ decreases by one.
If there is no valid move for the player of that turn, then the player loses. Assuming both players are playing optimally, determine the winner of the game.
This problem is a multi-case problem. The first line consists of an integer $T$ ($1 ≤ T ≤ 100$) which represents the number of test cases.
Each test case consists of an integer $N$ ($1 ≤ N < 10^{100\, 000}$) in a single line. The integer $N$ consists of only non-zero digits.
The sum of the number of digits of $N$ across all test cases does not exceed $100\, 000$.
For each test case, output a single string in a single line representing the winner of the game if both players play optimally. If Anda, the first player, wins the game, output Anda. Otherwise, output Kamu.
5 19823 2651265 9 73 123
Anda Kamu Kamu Kamu Anda
For the first test case, during the first turn, the only move Anda can perform is to choose the first digit to the third digit. After this move, the integer becomes $1823$, which has no valid moves for Kamu.
ICPC > Regionals > Asia Pacific > Indonesia > Indonesia National Contest > INC 2024 E번