Game!
Problem Description
One day, zbybr is playing a game with blankcqk, here are the rules of the game:
There is a circle of N stones, zbybr and blankcqk take turns taking the stones.
Each time, one player can choose to take one stone or take two adjacent stones.
You should notice that if there are 4 stones, and zbybr takes the 2nd, the 1st and 3rd stones are still not adjacent.
The winner is the one who takes the last stone.
Now, the game begins and zbybr moves first.
If both of them will play with the best strategy, can you tell me who will win the game?
Input
The first line of input contains an integer T, indicating the number of test cases (T≈100000).
For each case, there is a positive integer N (N ≤ 10^18).
Output
Output the name of the winner.
Example Input
2 1 2
Example Output
zbybr zbybr
代码如下:
#include<stdio.h>
int main()
{
int a,t;
scanf("%d",&t);
while(t--)
{
scanf("%d",&a);
if(a==1 ||a==2)
{
printf("zbybr\n");
}
else
{
printf("blankcqk\n");
}
}
return 0;
}
本文介绍了一种基于博弈论的游戏,玩家轮流从一圈石头中取走一个或两个相邻的石头,探讨了最优策略下胜者归属的问题。通过分析游戏规则,得出结论:当初始石头数量为1或2时,先手玩家获胜;否则后手玩家获胜。

被折叠的 条评论
为什么被折叠?



