欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1919A.Wallet Exchange
Wallet Exchange
Alice and Bob are bored, so they decide to play a game with their wallets. Alice has coins in her wallet, while Bob has 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:
- Choose to exchange wallets with their opponent, or to keep their current wallets.
- Remove coin from the player's current wallet. The current wallet cannot have 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.
Input
Each test contains multiple test cases. The first line contains a single integer () — the number of test cases. The description of the test cases follows.
The first and only line of each test case contains two integers and () — the number of coins in Alice's and Bob's wallets, respectively.
Output
For each test case, output "Alice" if Alice will win the game, and "Bob" if Bob will win the game.
Note
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, and .
- Since Alice's wallet is empty, Bob must choose to not swap their wallets in step 1 of his move. Now, and .
- 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, and .
- Bob chooses to swap wallets with Alice in step 1 of his move. Now, and .
- Alice chooses to not swap wallets with Bob in step 1 of her move. Now, and .
- Since Alice's wallet is empty, Bob can only choose to not swap wallets with Alice in step 1 of his move. Now, and .
- Since Alice's wallet is empty, Alice can only choose to swap wallets with Bob in step 1 of her move. Now, and .
- Since both Alice's wallet and Bob's wallet are empty, Bob is unable to make a move. Hence, Alice wins.
Samples
10
1 1
1 4
5 3
4 5
11 9
83 91
1032 9307
839204 7281
1000000000 1000000000
53110 2024
Bob
Alice
Bob
Alice
Bob
Bob
Alice
Alice
Bob
Bob
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |