题目来源:http://poj.org/problem?id=1740
刚刚看完博弈论的几篇文章,找了这水题,根据论文里面的思路很清楚了
#include <iostream> //只需要判断它是不是有N对相等的情况
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
bool f[1005];
int main()
{
int n;
while (~scanf("%d", &n))
{
if(!n)
break;
memset(f,0,sizeof(f));
int ans = 0;
for (int i=0;i<n;i++)
{
int a;
scanf("%d", &a);
if (f[a]) ans--;
else ans++;
f[a] = !f[a];
}
if(ans)
printf("1\n");
else
printf("0\n");
}
return 0;
}