A13660 | 01 Game
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Alica and Bob are playing a game.
Initially they have a binary string $s$ consisting of only characters 0 and 1.
Alice and Bob make alternating moves: Alice makes the first move, Bob makes the second move, Alice makes the third one, and so on. During each move, the current player must choose two different adjacent characters of string $s$ and delete them. For example, if $s = 1011001$ then the following moves are possible:
1. delete $s_1$ and $s_2$ : $\textbf{10}11001 \rightarrow 11001$ ;
2. delete $s_2$ and $s_3$ : $1\textbf{01}1001 \rightarrow 11001$ ;
3. delete $s_4$ and $s_5$ : $101\textbf{10}01 \rightarrow 10101$ ;
4. delete $s_6$ and $s_7$ : $10110\textbf{01} \rightarrow 10110$ .
If a player can't make any move, they lose. Both players play optimally. You have to determine if Alice can win.
Initially they have a binary string $s$ consisting of only characters 0 and 1.
Alice and Bob make alternating moves: Alice makes the first move, Bob makes the second move, Alice makes the third one, and so on. During each move, the current player must choose two different adjacent characters of string $s$ and delete them. For example, if $s = 1011001$ then the following moves are possible:
1. delete $s_1$ and $s_2$ : $\textbf{10}11001 \rightarrow 11001$ ;
2. delete $s_2$ and $s_3$ : $1\textbf{01}1001 \rightarrow 11001$ ;
3. delete $s_4$ and $s_5$ : $101\textbf{10}01 \rightarrow 10101$ ;
4. delete $s_6$ and $s_7$ : $10110\textbf{01} \rightarrow 10110$ .
If a player can't make any move, they lose. Both players play optimally. You have to determine if Alice can win.
输入格式
First line contains one integer $t$ ( $1 \le t \le 1000$ ) — the number of test cases.
Only line of each test case contains one string $s$ ( $1 \le |s| \le 100$ ), consisting of only characters 0 and 1.
Only line of each test case contains one string $s$ ( $1 \le |s| \le 100$ ), consisting of only characters 0 and 1.
输出格式
For each test case print answer in the single line.
If Alice can win print DA (YES in Russian) in any register. Otherwise print NET (NO in Russian) in any register.
If Alice can win print DA (YES in Russian) in any register. Otherwise print NET (NO in Russian) in any register.
输入输出样例
输入 #1
3 01 1111 0011
输出 #1
DA NET NET
In the first test case after Alice's move string $s$ become empty and Bob can not make any move.
In the second test case Alice can not make any move initially.
In the third test case after Alice's move string $s$ turn into $01$ . Then, after Bob's move string $s$ become empty and Alice can not make any move.
In the second test case Alice can not make any move initially.
In the third test case after Alice's move string $s$ turn into $01$ . Then, after Bob's move string $s$ become empty and Alice can not make any move.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted