CF1194D.1-2-K Game
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Alice and Bob play a game. There is a paper strip which is divided into n + 1 cells numbered from left to right starting from 0. There is a chip placed in the n-th cell (the last one).
Players take turns, Alice is first. Each player during his or her turn has to move the chip 1, 2 or k cells to the left (so, if the chip is currently in the cell i, the player can move it into cell i - 1, i - 2 or i - k). The chip should not leave the borders of the paper strip: it is impossible, for example, to move it k cells to the left if the current cell has number i < k. The player who can't make a move loses the game.
Who wins if both participants play optimally?
Alice and Bob would like to play several games, so you should determine the winner in each game.
Alice 和 Bob 玩一个游戏。有一张纸条,被从左到右依次编号为 0 到 n,共 n+1 个格子。一枚棋子初始放置在第 n 个格子(即最右侧的格子)中。
两人轮流进行操作,Alice 先手。在每一轮中,当前玩家必须将棋子向左移动 1、2 或 k 个格子(即:若棋子当前位于格子 i,则可将其移至格子 i−1、i−2 或 i−k)。棋子不能移出纸条边界:例如,当棋子当前位于编号为 i 的格子且 i<k 时,就无法向左移动 k 个格子。无法进行合法移动的玩家输掉游戏。
若双方均采取最优策略,谁将获胜?
Alice 和 Bob 希望进行多轮游戏,因此你需要对每轮游戏判断获胜者。
输入格式
The first line contains the single integer T (1 ≤ T ≤ 100) — the number of games. Next T lines contain one game per line. All games are independent.
Each of the next T lines contains two integers n and k (0 ≤ n ≤ 109, 3 ≤ k ≤ 109) — the length of the strip and the constant denoting the third move, respectively.
第一行包含一个整数 T(1≤T≤100)—— 游戏的局数。接下来的 T 行每行描述一局游戏。所有游戏相互独立。
接下来的 T 行中,每行包含两个整数 n 和 k(0≤n≤109,3≤k≤109)—— 分别表示纸条的长度和表示第三次移动的常数。
输出格式
For each game, print Alice if Alice wins this game and Bob otherwise.
对于每局游戏,若爱丽丝获胜则输出 Alice,否则输出 Bob。
输入输出样例
输入#1
4 0 3 3 3 3 4 4 4
输出#1
Bob Alice Bob Alice
输入解题思路,AI测评打分。不知道怎么写?