A12682 | 1-2-K Game
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
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<=10^{9}$ , $3<=k<=10^{9}$ ) — the length of the strip and the constant denoting the third move, respectively.
Each of the next $T$ lines contains two integers $n$ and $k$ ( $0<=n<=10^{9}$ , $3<=k<=10^{9}$ ) — the length of the strip and the constant denoting the third move, respectively.
输出格式
For each game, print Alice if Alice wins this game and Bob otherwise.
输入输出样例
输入 #1
4 0 3 3 3 3 4 4 4
输出 #1
Bob Alice Bob Alice
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted