题意:每行第一个数字为N表示有N堆石子,然后N个数字表示每堆石子个数,每次可以取一堆石子中的任意个,问先手赢还是输?
思路:裸的尼姆博弈。所有石子数异或起来起来就是答案。
//#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
const int MAXN = 1e3 + 5;
int main()
{
int n;
while (~scanf("%d", &n))
{
int ans = 0;
while (n--)
{
int t; scanf("%d", &t);
ans = ans^t;
}
if (ans) printf("Yes\n");
else printf("No\n");
}
return 0;
}
/*
2 45 45
3 3 6 9
*/