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 ≤ 10^18).
Output the name of the winner.
212Example Output
zbybrzbybrHint
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;}
新聞熱點
疑難解答