nyoj888 取石子(九) 反Nimm博弈
2017-02-26 16:57
169 查看
这题就是反Nimm博弈--分析见反Nimm博弈
AC代码
如有不当之处欢迎指出!
AC代码
#include <cstdio> #include <cmath> #include <algorithm> #include <cstring> #include <utility> #include <string> #include <iostream> #include <map> #include <set> #include <vector> #include <queue> #include <stack> using namespace std; #define eps 1e-10 #define inf 0x3f3f3f3f #define PI pair<int, int> typedef long long LL; const int maxn = 1e4 + 5; void in(int &a) { char ch; while((ch=getchar()) < '0' || ch >'9'); for(a = 0; ch >= '0' && ch <= '9'; ch = getchar()) { a = a * 10 + ch - '0'; } } int main() { int T, n; scanf("%d", &T); while(T--) { in(n); int res = 0, x, cnt = 0; for(int i = 0; i < n; ++i) { in(x); res ^= x; if(x > 1) ++cnt; } if(cnt == 0 && res || !res && cnt >= 2) printf("Hrdv\n"); else printf("Yougth\n"); } return 0; }
如有不当之处欢迎指出!
相关文章推荐
- nyoj585 取石子(六) Nimm博弈
- 取石子(九)(十)(nyoj 888 && 913)
- NYOJ 题目888取石子(九)(anti-nim)
- nyoj913 取石子(十) SG函数 + Nimm博弈
- NYOJ 888 取石子(九)
- nyoj135 取石子(二) Nimm博弈
- NYOJ 888 取石子(九)
- POJ-1067取石子游戏,威佐夫博弈范例题/NYOJ-161,主要在于这个黄金公式~~
- 取石子(七)(NYOJ 833)
- nyoj 737 石子合并(一)(区间DP)
- NYOJ 23 取石子(一)
- nyoj737 石子合并 详细
- NYOJ833取石子
- NYOJ 737 石子合并(一)(区间dp)
- nyoj 358 取石子(五)(Fibonacci博弈)(博弈——找规律)
- nyoj 取石子系列
- NYOJ-取石子(六)
- NYOJ 23-取石子(一):博弈
- nyoj 取石子(八)(威佐夫博弈,多种情况)
- 【区间DP】NYOJ 737石子合并+POJ 2955 Brackets(括号匹配)+NYOJ 15 括号匹配(二)