CF1719A.Chip Game
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Burenka and Tonya are playing an old Buryat game with a chip on a board of n×m cells.
At the beginning of the game, the chip is located in the lower left corner of the board. In one move, the player can move the chip to the right or up by any odd number of cells (but you cannot move the chip both to the right and up in one move). The one who cannot make a move loses.
Burenka makes the first move, the players take turns. Burenka really wants to win the game, but she is too lazy to come up with a strategy, so you are invited to solve the difficult task of finding it. Name the winner of the game (it is believed that Burenka and Tonya are masters of playing with chips, so they always move in the optimal way).
Chip's starting cell is green, the only cell from which chip can't move is red. if the chip is in the yellow cell, then blue cells are all options to move the chip in one move.
布尔恩卡和托尼娅正在玩一个古老的布里亚特游戏,游戏在一个 n×m 的方格棋盘上进行,棋盘上有一枚棋子。
游戏开始时,棋子位于棋盘的左下角。在一次移动中,玩家可以将棋子向右或向上移动任意奇数个格子(但不能在同一回合中既向右又向上移动)。无法进行移动的一方判负。
布尔恩卡先手,双方轮流行动。布尔恩卡非常想赢得这场比赛,但她太懒了,不愿自己设计制胜策略,因此请你来解决这个难题——判断谁将获胜(假设布尔恩卡与托尼娅都是棋子游戏的大师,总能采取最优策略)。
棋子的起始位置为绿色格子;唯一无法再移动的格子为红色格子;若棋子位于黄色格子,则所有蓝色格子均为其一步可到达的位置。
输入格式
The first line contains one integer t (1≤t≤104) — the number of test cases. The following is a description of the input data sets.
The only line of each test case contains two integers n and m (1≤n,m≤109) — the dimensions of the game board.
第一行包含一个整数 t(1≤t≤104)—— 测试用例的数量。接下来是对各输入数据集的描述。
每个测试用例仅有一行,包含两个整数 n 和 m(1≤n,m≤109)—— 游戏棋盘的尺寸。
输出格式
For each test case print a single line — the name of the winner of the game ("Burenka" or "Tonya").
对于每个测试用例,输出一行——游戏的获胜者姓名(“Burenka” 或 “Tonya”)。
输入输出样例
输入#1
6 1 1 1 4 5 6 2 2 6 3 999999999 1000000000
输出#1
Tonya Burenka Burenka Tonya Burenka Burenka
说明/提示
In the first case, Burenka has no move, so Tonya wins.
In the second case, Burenka can move 3 cells to the right, after which Tony will not be able to make a move, which means that Burenka wins.
In the third case, Burenka can move 5 squares to the right. Then we can say that we have a game on a board of 1×5 cells, and Tonya is the first player. In such game the second player wins, so in the original one Burenka will win.
在第一种情况下,Burenka 无法移动,因此 Tonya 获胜。
在第二种情况下,Burenka 可以向右移动 3 格,此后 Tony 将无法再移动,这意味着 Burenka 获胜。
在第三种情况下,Burenka 可以向右移动 5 格。此时,我们可将局面视为一个 1×5 的棋盘上的游戏,且 Tonya 为先手玩家。在此类游戏中,后手玩家获胜,因此在原始游戏中 Burenka 将获胜。
输入解题思路,AI测评打分。不知道怎么写?