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****************************************************/新聞熱點
疑難解答