CF1738C.Even Number Addicts

普及/提高-

通过率:0%

时间限制:2.00s

内存限制:512MB

AC君温馨提醒

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

题目描述

Alice and Bob are playing a game on a sequence a1,a2,…,ana_1, a_2, \dots, a_n of length nn. They move in turns and Alice moves first.

In the turn of each player, he or she should select an integer and remove it from the sequence. The game ends when there is no integer left in the sequence.

Alice wins if the sum of her selected integers is even; otherwise, Bob wins.

Your task is to determine who will win the game, if both players play optimally.

Alice 和 Bob 在一个长度为 nn 的序列 a1,a2,…,ana_1, a_2, \dots, a_n 上进行一场游戏。他们轮流行动,Alice 先手。

在每位玩家的回合中,他或她需选择一个整数并将其从序列中移除。当序列中不再剩有任何整数时,游戏结束。

若 Alice 所选整数之和为偶数,则 Alice 获胜;否则 Bob 获胜。

你的任务是:在双方均采取最优策略的前提下,判断谁将赢得这场游戏。

输入格式

Each test contains multiple test cases. The first line contains an integer tt (1≤t≤1001 \leq t \leq 100) — the number of test cases. The following lines contain the description of each test case.

The first line of each test case contains an integer nn (1≤n≤1001 \leq n \leq 100), indicating the length of the sequence.

The second line of each test case contains nn integers a1,a2,…,ana_1, a_2, \dots, a_n (−109≤ai≤109-10^9 \leq a_i \leq 10^9), indicating the elements of the sequence.

每个测试包含多个测试用例。第一行包含一个整数 tt(1≤t≤1001 \leq t \leq 100),表示测试用例的数量。接下来的行描述各个测试用例。

每个测试用例的第一行包含一个整数 nn(1≤n≤1001 \leq n \leq 100),表示序列的长度。

每个测试用例的第二行包含 nn 个整数 a1,a2,…,ana_1, a_2, \dots, a_n(−109≤ai≤109-10^9 \leq a_i \leq 10^9),表示该序列的元素。

输出格式

For each test case, output "Alice" (without quotes) if Alice wins and "Bob" (without quotes) otherwise.

对于每个测试用例,如果 Alice 获胜,则输出 “Alice”(不带引号);否则输出 “Bob”(不带引号)。

输入输出样例

  • 输入#1

    4
    3
    1 3 5
    4
    1 3 5 7
    4
    1 2 3 4
    4
    10 20 30 40

    输出#1

    Alice
    Alice
    Bob
    Alice

说明/提示

In the first and second test cases, Alice always selects two odd numbers, so the sum of her selected numbers is always even. Therefore, Alice always wins.

In the third test case, Bob has a winning strategy that he always selects a number with the same parity as Alice selects in her last turn. Therefore, Bob always wins.

In the fourth test case, Alice always selects two even numbers, so the sum of her selected numbers is always even. Therefore, Alice always wins.

在第一和第二个测试用例中,Alice 总是选择两个奇数,因此她所选数字的和总是偶数。所以 Alice 总是获胜。

在第三个测试用例中,Bob 有一个必胜策略:他总是选择一个与 Alice 上一轮所选数字奇偶性相同的数字。因此 Bob 总是获胜。

在第四个测试用例中,Alice 总是选择两个偶数,因此她所选数字的和总是偶数。所以 Alice 总是获胜。

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

首页