这题就是反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;
}
如有不当之处欢迎指出!