摘要:
/*Accepted 2147 0MS 200K 173 B C++ Yu */#include <stdio.h>//n和m不同为奇数,先手胜int main(){ int n, m; while(scanf("%d%d", &n, &m), n + m) { puts( ((n & 1) && (m & 1))? "What a pity!" : "Wonderful!"); } return 0;} 阅读全文
摘要:
/*Accepted 1564 0MS 200K 135 B C++ Yu */#include <stdio.h>//画图YY//奇数先手赢,反之后手int main(){ int n; while(scanf("%d", &n), n) { puts(n & 1 ? "ailyanlu" : "8600"); } return 0;} 阅读全文
摘要:
/*巴什博弈当取的石子总数为b + 1的倍数时,先取必败,因为对手每次都能凑出b + 1的倍数,通过取1......b的一种情况。*/#include<stdio.h>int main(){ int a, b, t; scanf("%d", &t); while(t --) { scanf("%d%d", &a, &b); a = a % (b + 1); puts((a) ? "first" : "second"); } return 0;} 阅读全文
摘要:
/*巴什博弈我们注意到可以取的牌数包含了1和2这两种情况,剩下的不用管,当你给对手剩下3*n张牌时,你就赢了。巴什博弈的模型..*/#include<stdio.h>int main(){ int n; while(scanf("%d", &n) == 1) { puts(n % 3 == 0 ? "Cici" : "Kiki"); } return 0;} 阅读全文
摘要:
#include<stdio.h>#include<string.h>#include<stdlib.h>const int MAXN = 1005;int fib[MAXN], e[MAXN], h[20];void calcFib(){ int i; fib[1] = 1, fib[2] = 2; for(i = 3; i <= 16; i ++) { fib[i] = fib[i - 1] + fib[i - 2]; }}/*求SG值*/void calcE(){ int i, j, k; e[0] = 0, e[1] = 1; ... 阅读全文
摘要:
/*转换成Nim模型,对于每个棋子位于的位置b,G[b] = 0,即sg[b] = b多个棋子异或一遍就得出答案了,为0先手必败。*/#include<stdio.h>int main(){ int n, a, b; while(scanf("%d", &n), n) { scanf("%d", &a); n --; while(n --) { scanf("%d", &b); a ^= b; } puts(a ? "Rabbit Win!" : "... 阅读全文
摘要:
/*Nim模型*/#include<stdio.h>#include<string.h>#include<stdlib.h>const int MAXM = 105;int m, ni[MAXM];int main(){ int i, cnt, res; while(scanf("%d", &m), m) { res = cnt = 0; for(i = 1; i <= m; i ++) { scanf("%d", &ni[i]); res ^= ni[i]; } ... 阅读全文
摘要:
/*巴什博弈的模型*/#include<stdio.h>int main(){ int n, m, T; scanf("%d", &T); while(T --) { scanf("%d%d", &n, &m); puts((n % (m + 1)) ? "Grass" : "Rabbit"); } return 0;} 阅读全文
摘要:
/*巴什博弈先判断是不是先手必败*/#include<stdio.h>int main(){ int m, n, i; while(scanf("%d%d", &m, &n) != EOF) { if(m > n) //这种情况先手非必败的话只有一种出法 { if(m % (n + 1) == 0) { puts("none"); continue; } else prin... 阅读全文