Think: 在 草稿纸上 演算多次 后 便可得知 只有当 N >= 2 时zbybr才会获胜 否则 blankcqk获胜 同时 数值 很大 所以 用 long long int 来定义
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
题目大意: 1.A 和 B 轮流取石子 2.每次可以取 1个 或者 相邻的 2个 石子 3.同时例如 在 1 2 3 4中 当 3 4 被 取走后 1 4不算相邻
#include<bits/stdc++.h>using namespace std;int main() { long long int T; while(cin >> T) { while(T --) { long long int x; cin >> x; if (x <= 2) cout << "zbybr" <<endl; else cout << "blankcqk" <<endl; }} return 0; }/***************************************************User name: Result: AcceptedTake time: 124msTake Memory: 164KBSubmit time: 2017-02-18 15:42:23****************************************************/新闻热点
疑难解答