310484: CF1841A. Game with Board

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Game with Boardtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard output

Alice and Bob play a game. They have a blackboard; initially, there are $n$ integers written on it, and each integer is equal to $1$.

Alice and Bob take turns; Alice goes first. On their turn, the player has to choose several (at least two) equal integers on the board, wipe them and write a new integer which is equal to their sum.

For example, if the board currently contains integers $\{1, 1, 2, 2, 2, 3\}$, then the following moves are possible:

  • choose two integers equal to $1$, wipe them and write an integer $2$, then the board becomes $\{2, 2, 2, 2, 3\}$;
  • choose two integers equal to $2$, wipe them and write an integer $4$, then the board becomes $\{1, 1, 2, 3, 4\}$;
  • choose three integers equal to $2$, wipe them and write an integer $6$, then the board becomes $\{1, 1, 3, 6\}$.

If a player cannot make a move (all integers on the board are different), that player wins the game.

Determine who wins if both players play optimally.

Input

The first line contains one integer $t$ ($1 \le t \le 99$) — the number of test cases.

Each test case consists of one line containing one integer $n$ ($2 \le n \le 100$) — the number of integers equal to $1$ on the board.

Output

For each test case, print Alice if Alice wins when both players play optimally. Otherwise, print Bob.

ExampleInput
2
3
6
Output
Bob
Alice
Note

In the first test case, $n = 3$, so the board initially contains integers $\{1, 1, 1\}$. We can show that Bob can always win as follows: there are two possible first moves for Alice.

  • if Alice chooses two integers equal to $1$, wipes them and writes $2$, the board becomes $\{1, 2\}$. Bob cannot make a move, so he wins;
  • if Alice chooses three integers equal to $1$, wipes them and writes $3$, the board becomes $\{3\}$. Bob cannot make a move, so he wins.

In the second test case, $n = 6$, so the board initially contains integers $\{1, 1, 1, 1, 1, 1\}$. Alice can win by, for example, choosing two integers equal to $1$, wiping them and writing $2$ on the first turn. Then the board becomes $\{1, 1, 1, 1, 2\}$, and there are three possible responses for Bob:

  • if Bob chooses four integers equal to $1$, wipes them and writes $4$, the board becomes $\{2,4\}$. Alice cannot make a move, so she wins;
  • if Bob chooses three integers equal to $1$, wipes them and writes $3$, the board becomes $\{1,2,3\}$. Alice cannot make a move, so she wins;
  • if Bob chooses two integers equal to $1$, wipes them and writes $2$, the board becomes $\{1, 1, 2, 2\}$. Alice can continue by, for example, choosing two integers equal to $2$, wiping them and writing $4$. Then the board becomes $\{1,1,4\}$. The only possible response for Bob is to choose two integers equal to $1$ and write $2$ instead of them; then the board becomes $\{2,4\}$, Alice cannot make a move, so she wins.

Input

题意翻译

Alice 和 Bob 玩游戏,他们有一块黑板。最初,有 $n$ 个整数 $1$。Alice 和 Bob 轮流操作,Alice 先手。 轮到时,玩家必须在棋盘上选择几个(至少两个)相等的整数,擦除它们,然后写一个等于它们总和的新整数。 如果玩家不能移动(棋盘上的所有整数都不同),该玩家将赢得游戏。 如果两名选手都发挥最佳,则确定谁获胜。

Output

题目大意:
Alice和Bob在黑板上玩一个游戏,最初黑板上写有n个整数,每个整数都是1。Alice和Bob轮流进行操作,Alice先手。在每一轮中,玩家必须选择至少两个相同的整数,擦除它们,并在黑板上写一个新的整数,这个整数等于它们之和。例如,如果黑板上当前包含整数{1, 1, 2, 2, 2, 3},则可能的移动有:选择两个整数1,擦除它们并写一个整数2,然后黑板变成{2, 2, 2, 2, 3};选择两个整数2,擦除它们并写一个整数4,然后黑板变成{1, 1, 2, 3, 4};选择三个整数2,擦除它们并写一个整数6,然后黑板变成{1, 1, 3, 6}。如果一个玩家无法进行移动(黑板上的所有整数都不同),那么那个玩家赢得游戏。确定如果两个玩家都进行最优游戏,谁会赢。

输入输出数据格式:
输入:
第一行包含一个整数t(1≤t≤99),表示测试用例的数量。
每个测试用例由一行组成,包含一个整数n(2≤n≤100),表示黑板上等于1的整数的数量。

输出:
对于每个测试用例,如果Alice在两个玩家都进行最优游戏时获胜,则打印“Alice”。否则,打印“Bob”。题目大意: Alice和Bob在黑板上玩一个游戏,最初黑板上写有n个整数,每个整数都是1。Alice和Bob轮流进行操作,Alice先手。在每一轮中,玩家必须选择至少两个相同的整数,擦除它们,并在黑板上写一个新的整数,这个整数等于它们之和。例如,如果黑板上当前包含整数{1, 1, 2, 2, 2, 3},则可能的移动有:选择两个整数1,擦除它们并写一个整数2,然后黑板变成{2, 2, 2, 2, 3};选择两个整数2,擦除它们并写一个整数4,然后黑板变成{1, 1, 2, 3, 4};选择三个整数2,擦除它们并写一个整数6,然后黑板变成{1, 1, 3, 6}。如果一个玩家无法进行移动(黑板上的所有整数都不同),那么那个玩家赢得游戏。确定如果两个玩家都进行最优游戏,谁会赢。 输入输出数据格式: 输入: 第一行包含一个整数t(1≤t≤99),表示测试用例的数量。 每个测试用例由一行组成,包含一个整数n(2≤n≤100),表示黑板上等于1的整数的数量。 输出: 对于每个测试用例,如果Alice在两个玩家都进行最优游戏时获胜,则打印“Alice”。否则,打印“Bob”。

加入题单

上一题 下一题 算法标签: