Game!
来源:互联网 发布:淘宝外包多少钱 编辑:程序博客网 时间:2024/04/30 04:33
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
212
Example Output
zbybrzbybr
Hint
Author
题目大意:
石子围成一圈,zbybr和blankcqk轮流取石子,每人可以一次取一个,也可以取相邻的两个。zbybr先开始。
think:
这是一道简单的博弈论问题(还是英文问题哦),可以试着推演一下,就可以知道结果。
我在比赛时,开始就推三个的情况(1, 2的情况已给),然后一直推到了7,发现之后都是blankcpy赢,然后又回来看了一下,理了理思路,就可以了。
代码实现:
#include<stdio.h>#include<string.h>int main(){ int t; long long int a; scanf("%d", &t); while(t--) { scanf("%lld", &a); if(a==1||a==2) printf("zbybr\n"); else printf("blankcqk\n"); } return 0;}
- game
- game
- game
- game...
- Game
- Game
- Game
- Game
- game
- Game
- Game
- game
- game
- Game
- GAME
- Game
- Game
- Game
- java学习日记_100:线程的第二种实现方式——实现Runnable接口
- 1040. Longest Symmetric String
- C++之操作符重载
- 内容观察者
- 素数标记 Interesting Numbers URAL - 2070
- Game!
- shell脚本
- C++primer第五版P15(1.4.4)
- 287. Find the Duplicate Number--binary search/快慢指针
- java多线程详解二互斥同步方式实现多线程
- 存储过程
- 使用google注册教程
- HorizontalScrollView
- 基于canvas的二维码邀请函生成插件