第一次用set,但是不知道这个为什么这个要去重,可能是亦或两次就和没亦或一样吧
#include<bits/stdc++.h>
#include<set>
using namespace std;
const int N=100000005;
set<int>q;
int SG[N];
int n;
int check(int x)
{
int sum=0;
while(x)
{
if(x%2==1)
sum++;
x/=2;
}
return sum;
}
int main()
{
while(scanf("%d",&n)!=EOF)
{
int ans=0,x;
q.clear();
for(int i=0; i<n; i++)
{
scanf("%d",&x);
q.insert(x);
}
set<int>::iterator it;
for(it=q.begin(); it!=q.end(); it++)
{
int tmp=*it;
if((check(tmp))%2==1)
{
ans^=(tmp*2);
}
else
{
ans^=(tmp*2+1);
}
}
if(ans==0)
printf("Yes\n");
else
printf("No\n");
}
return 0;
}
算结论题,这么用还是麻烦了一点,像别的题解用count也星