CF1373B.01 Game

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Alica and Bob are playing a game.

Initially they have a binary string ss 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 ss and delete them. For example, if s=1011001s = 1011001 then the following moves are possible:

  1. delete s1s_1 and s2s_2: 1011001→11001\textbf{10}11001 \rightarrow 11001;
  2. delete s2s_2 and s3s_3: 1011001→110011\textbf{01}1001 \rightarrow 11001;
  3. delete s4s_4 and s5s_5: 1011001→10101101\textbf{10}01 \rightarrow 10101;
  4. delete s6s_6 and s7s_7: 1011001→1011010110\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.

爱丽丝和鲍勃正在玩一个游戏。

初始时,他们有一个仅由字符 0 和 1 组成的二进制字符串 ss。

爱丽丝和鲍勃轮流进行操作:爱丽丝先手,鲍勃第二手,爱丽丝第三手,依此类推。在每次操作中,当前玩家必须选择字符串 ss 中两个不同且相邻的字符并将其删除。例如,若 s=1011001s = 1011001,则以下操作是可行的:

  1. 删除 s1s_1 和 s2s_2:1011001→11001\textbf{10}11001 \rightarrow 11001;
  2. 删除 s2s_2 和 s3s_3:1011001→110011\textbf{01}1001 \rightarrow 11001;
  3. 删除 s4s_4 和 s5s_5:1011001→10101101\textbf{10}01 \rightarrow 10101;
  4. 删除 s6s_6 和 s7s_7:1011001→1011010110\textbf{01} \rightarrow 10110。

若某位玩家无法进行任何操作,则该玩家输掉游戏。双方均以最优策略进行游戏。你需要判断爱丽丝是否能够获胜。

输入格式

First line contains one integer tt (1≤t≤10001 \le t \le 1000) — the number of test cases.

Only line of each test case contains one string ss (1≤∣s∣≤1001 \le |s| \le 100), consisting of only characters 0 and 1.

第一行包含一个整数 tt(1≤t≤10001 \le t \le 1000)—— 测试用例的数量。

每个测试用例仅有一行,包含一个字符串 ss(1≤∣s∣≤1001 \le |s| \le 100),该字符串仅由字符 0 和 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.

对于每个测试用例,在单独的一行中输出答案。

如果 Alice 能获胜,则以任意大小写形式输出 DA(俄语中的“YES”);否则以任意大小写形式输出 NET(俄语中的“NO”)。

输入输出样例

  • 输入#1

    3
    01
    1111
    0011

    输出#1

    DA
    NET
    NET

说明/提示

In the first test case after Alice's move string ss 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 ss turn into 0101. Then, after Bob's move string ss become empty and Alice can not make any move.

在第一个测试用例中,Alice 操作后字符串 ss 变为空,Bob 无法进行任何操作。

在第二个测试用例中,Alice 最初就无法进行任何操作。

在第三个测试用例中,Alice 操作后字符串 ss 变为 0101。然后,Bob 操作后字符串 ss 变为空,Alice 无法进行任何操作。

输入解题思路,AI测评打分。不知道怎么写?

首页