您的位置:首页 > 其它

nyoj888 取石子(九) 反Nimm博弈

2017-02-26 16:57 169 查看
          这题就是反Nimm博弈--分析见反Nimm博弈

  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;
}


如有不当之处欢迎指出!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: