CF1919A.Wallet Exchange

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Alice and Bob are bored, so they decide to play a game with their wallets. Alice has aa coins in her wallet, while Bob has bb coins in his wallet.

Both players take turns playing, with Alice making the first move. In each turn, the player will perform the following steps in order:

  1. Choose to exchange wallets with their opponent, or to keep their current wallets.
  2. Remove 11 coin from the player's current wallet. The current wallet cannot have 00 coins before performing this step.

The player who cannot make a valid move on their turn loses. If both Alice and Bob play optimally, determine who will win the game.

爱丽丝和鲍勃感到无聊,于是决定用他们的钱包来玩一个游戏。爱丽丝的钱包里有 aa 枚硬币,而鲍勃的钱包里有 bb 枚硬币。

两名玩家轮流进行游戏,爱丽丝先手。在每一轮中,当前玩家需按顺序执行以下步骤:

  1. 选择与对手交换钱包,或保留自己当前的钱包;
  2. 从自己当前的钱包中移除 11 枚硬币。执行此步骤前,当前钱包中的硬币数不能为 00。

无法在自己的回合中执行合法操作的玩家判负。若爱丽丝和鲍勃均采取最优策略,请判断谁将赢得该游戏。

输入格式

Each test contains multiple test cases. The first line contains a single integer tt (1≤t≤10001 \leq t \leq 1000) — the number of test cases. The description of the test cases follows.

The first and only line of each test case contains two integers aa and bb (1≤a,b≤1091 \le a, b \le 10^9) — the number of coins in Alice's and Bob's wallets, respectively.

每个测试包含多个测试用例。第一行包含一个整数 tt(1≤t≤10001 \leq t \leq 1000)—— 测试用例的数量。随后是各测试用例的描述。

每个测试用例仅有一行,包含两个整数 aa 和 bb(1≤a,b≤1091 \le a, b \le 10^9)—— 分别表示爱丽丝和鲍勃钱包中的硬币数量。

输出格式

For each test case, output "Alice" if Alice will win the game, and "Bob" if Bob will win the game.

对于每个测试用例,如果 Alice 将赢得游戏,则输出 “Alice”;如果 Bob 将赢得游戏,则输出 “Bob”。

输入输出样例

  • 输入#1

    10
    1 1
    1 4
    5 3
    4 5
    11 9
    83 91
    1032 9307
    839204 7281
    1000000000 1000000000
    53110 2024

    输出#1

    Bob
    Alice
    Bob
    Alice
    Bob
    Bob
    Alice
    Alice
    Bob
    Bob

说明/提示

In the first test case, an example of the game is shown below:

  • Alice chooses to not swap wallets with Bob in step 1 of her move. Now, a=0a=0 and b=1b=1.
  • Since Alice's wallet is empty, Bob must choose to not swap their wallets in step 1 of his move. Now, a=0a=0 and b=0b=0.
  • Since both Alice's and Bob's wallets are empty, Alice is unable to make a move. Hence, Bob wins.

In the second test case, an example of the game is shown below:

  • Alice chooses to swap wallets with Bob in step 1 of her move. Now, a=3a=3 and b=1b=1.
  • Bob chooses to swap wallets with Alice in step 1 of his move. Now, a=1a=1 and b=2b=2.
  • Alice chooses to not swap wallets with Bob in step 1 of her move. Now, a=0a=0 and b=2b=2.
  • Since Alice's wallet is empty, Bob can only choose to not swap wallets with Alice in step 1 of his move. Now, a=0a=0 and b=1b=1.
  • Since Alice's wallet is empty, Alice can only choose to swap wallets with Bob in step 1 of her move. Now, a=0a=0 and b=0b=0.
  • Since both Alice's wallet and Bob's wallet are empty, Bob is unable to make a move. Hence, Alice wins.

在第一个测试用例中,游戏的一个示例如下所示:

  • Alice 在她的回合的第 1 步选择不与 Bob 交换钱包。此时,a=0a=0 且 b=1b=1。
  • 由于 Alice 的钱包为空,Bob 在他的回合的第 1 步必须选择不与 Alice 交换钱包。此时,a=0a=0 且 b=0b=0。
  • 由于 Alice 和 Bob 的钱包均为空,Alice 无法进行任何操作。因此,Bob 获胜。

在第二个测试用例中,游戏的一个示例如下所示:

  • Alice 在她的回合的第 1 步选择与 Bob 交换钱包。此时,a=3a=3 且 b=1b=1。
  • Bob 在他的回合的第 1 步选择与 Alice 交换钱包。此时,a=1a=1 且 b=2b=2。
  • Alice 在她的回合的第 1 步选择不与 Bob 交换钱包。此时,a=0a=0 且 b=2b=2。
  • 由于 Alice 的钱包为空,Bob 在他的回合的第 1 步只能选择不与 Alice 交换钱包。此时,a=0a=0 且 b=1b=1。
  • 由于 Alice 的钱包为空,Alice 在她的回合的第 1 步只能选择与 Bob 交换钱包。此时,a=0a=0 且 b=0b=0。
  • 由于 Alice 和 Bob 的钱包均为空,Bob 无法进行任何操作。因此,Alice 获胜。

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

首页