Game! SDUT(环形博弈)
2015-08-03 10:07
281 查看
Game!
Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^
题目描述
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?
输入
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 ≤ 1018).
输出
Output the name of the winner.示例输入
2 1 2
示例输出
zbybr zbybr 题目大意:zbybr先手,谁将环形石子最后一个拿走谁赢 对于环形的博弈,先手只可能在他能拿石子个数的范围内取胜,否则后手赢。因为当石子个数大于先手能拿的个数,若先手拿完后,剩下奇数个后手拿与先手对应位置的石子 即可,为偶则拿对应的两个,总可以让先手输#include <iostream> #include<cstdio> #include<cstring> #include<algorithm> #define L long long using namespace std; int main() { int cla; L n; ios::sync_with_stdio(false); cin>>cla; ios::sync_with_stdio(false); while(cla--) { cin>>n; if(n<=2) puts("zbybr"); else { puts("blankcqk"); } } return 0; }
相关文章推荐
- eclipse4.2版本下面安装ADT,安装已经完成了,但没有ADT的那个图标显示
- 开源点评:Protocol Buffers介绍
- [Android]ScrollView和ListView上方的headView的下拉放大效果-PullZoomView的使用篇
- 字符流的学习
- Kth Smallest Element in a BST
- 【Unity】从Profile中窥探Unity的内存管理
- 怎样才能读透一本书
- HDU 5339 Untitled(DFS)
- HDU 2188 悼念512汶川大地震遇难同胞——选拔志愿者 (巴什博弈)
- OSAL函数分析-osalTimeUpdate
- CoreData使用
- Java代码实现“年-月-日 上午/下午时:分:秒”
- 写在前面的话
- php中ob函数缓冲机制深入理解
- C# winform键盘钩子
- hdu5131
- 杭电 2041 超级楼梯 递归
- 完整英文版资产负债表、利润表及现金流量表
- HDOJ 士兵队列训练问题 1276【vector】
- C#如何自动选择出系统中最合适的IP地址