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
代码:很简单的一道博弈
思路:假设如果它是一条直线,无论如何都是先取的那一个人赢,只要他从中间取使得左右两边个数一样,他一定赢。所以题目现在是圆,先取的人会将其取成线,变成线后,后取的人就一定赢了。
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; }
相关文章推荐
- 【SDUT 3253】 Game!
- sdut 3253 Game! 博弈
- sdut2414 An interesting game 费用流
- Game! SDUT(环形博弈)
- SDUT 2414 An interesting game(最大费用流)
- 【优先队列/huffman】sdut 2848/poj 3253——Fence Repair
- 【SDUT2414】An interesting game——最小费用
- zoj 3329 One Person Game(概率dp)
- SDUT 3334 数据结构实验之栈七:出栈序列判定
- SDUT 1570 C 旅行(DFS)
- 矩阵问题(题目:SDUT 2744 2254)
- Leetcode_jump-game (updated c++ and python version)
- (模板题)sdut 2125 数据结构实验之串二:字符串匹配(KMP)
- Game
- hdu5725 Game 2016年多校C
- CF - 409 - A. The Great Game(IQ)
- POJ 2484 A Funny Game(博弈论)
- “Guess the number” game
- SDUT 2087 离散事件模拟-银行管理
- Kindergarten Counting Game - UVa494