hdu 1850 Being a Good Boy in Spring Festival

http://acm.hdu.edu.cn/showproblem.php?pid=1850

#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>

using namespace std;
int a[105];
int main()
{
    int n;
    while(cin>>n)
    {
        if(n==0)
        break;
        int sum=0;
        for(int i=1;i<=n;++i)
        {
            cin>>a[i];
            sum=sum^a[i];
        }
        int ans=0;
        for(int i=1;i<=n;++i)
        {
            if(a[i]>(sum^a[i]))
            ++ans;
        }
        cout<<ans<<endl;
    }
    return 0;
}

你可能感兴趣的:(spring)