QOJ.ac

QOJ

実行時間制限: 1.0 s メモリ制限: 2048 MB 満点: 100

#15929. 乘法游戏

統計

Alice 和 Bob 正在课堂上进行乘法和除法的练习。他们很快就觉得无聊了,于是决定玩一个他们自己发明的游戏。

游戏开始时有一个目标整数 $N \ge 2$,以及一个整数 $M = 1$。Alice 和 Bob 轮流进行操作。在每个回合中,玩家选择 $N$ 的一个质因数 $p$,并将 $M$ 乘以 $p$。如果玩家的操作使得 $M$ 的值等于目标值 $N$,则该玩家获胜。如果 $M > N$,则游戏平局。

假设两名玩家都采取最优策略,谁(如果有的话)将会获胜?

输入格式

输入的第一行包含一个整数 $T$ ($1 \le T \le 10\,000$),表示接下来的测试用例数量。

接下来的 $T$ 行,每行描述一个测试用例。每个测试用例由一个整数 $N$ ($2 \le N \le 2^{31} - 1$) 和率先进行操作的玩家名字组成。名字为 AliceBob

输出格式

对于每个测试用例,假设双方都采取最优策略,输出获胜者的名字(AliceBob);如果没有获胜者,则输出 tie

样例

输入样例 1

10
10 Alice
20 Bob
30 Alice
40 Bob
50 Alice
60 Bob
70 Alice
80 Bob
90 Alice
100 Bob

输出样例 1

Bob
Bob
tie
tie
Alice
tie
tie
tie
tie
Alice

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.