您的位置:首页 > 其它

ZCMU—C

2017-03-09 20:51 169 查看
C - Game!
Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d
& %I64u
Submit Status

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.

Sample Input

2
1
2


Sample Output

zbybr
zbybr


【分析】

经典题...石子游戏

如果只有一个或两个石头,先手胜

如果石头大于两个,先手取石子后会使石子变成两堆,这时后手只要将剩下的石子继续分成对称的两堆,那么后者一定会赢

【代码】

#include<stdio.h>
int main()
{
int pp;scanf("%d",&pp);
while(pp--)
{
long long n;scanf("%lld",&n);
if(n<3)
printf("zbybr\n");
else
printf("blankcqk\n");
}
return 0;
}

所以当先者取走后,后者取走一个或者两个,将剩下的石子分成对称的两段,以此类推,那么如果石子数大于2后者一定赢。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: