A15419 | Even Number Addicts
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Alice and Bob are playing a game on a sequence $a_1, a_2, \dots, a_n$ of length $n$ . 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.
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.
输入格式
Each test contains multiple test cases. The first line contains an integer $t$ ( $1 \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 $n$ ( $1 \leq n \leq 100$ ), indicating the length of the sequence.
The second line of each test case contains $n$ integers $a_1, a_2, \dots, a_n$ ( $-10^9 \leq a_i \leq 10^9$ ), indicating the elements of the sequence.
The first line of each test case contains an integer $n$ ( $1 \leq n \leq 100$ ), indicating the length of the sequence.
The second line of each test case contains $n$ integers $a_1, a_2, \dots, a_n$ ( $-10^9 \leq a_i \leq 10^9$ ), indicating the elements of the sequence.
输出格式
For each test case, output "Alice" (without quotes) if Alice wins and "Bob" (without quotes) otherwise.
输入输出样例
输入 #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.
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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted