您的位置:首页 > 其它

SDUT 3253 Game!

2017-03-14 20:31 225 查看
Game!

Time Limit: 1000MS Memory Limit: 65536KB

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 t, n;
scanf("%d", &t);
while(t--)
{
scanf("%d", &n);
if(n == 1) printf("zbybr\n");//不是圆
else if(n == 2) printf("zbybr\n");//不是圆
else printf("blankcqk\n");//是圆
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: