Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 7841    Accepted Submission(s): 4811
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;
#define FIN     freopen("input.txt","r",stdin);
#define FOUT    freopen("output.txt","w",stdout);
#define INF     0x3f3f3f3f
#define INFLL   0x3f3f3f3f3f3f3f
#define lson    l,m,rt<<1
#define rson    m+1,r,rt<<1|1
typedef long long LL;
typedef pair<int, int> PII;
using namespace std;
int a[105];
int main() {
    //FIN
    int n;
    while(~scanf("%d", &n) && n) {
        int ans = 0;
        int sum = 0;
        for(int i = 1; i <= n; i++) {
            scanf("%d", &a[i]);
            ans ^= a[i];
        }
        for(int i = 1; i <= n; i++) {
            if((ans ^ a[i]) < a[i]) sum++;
        }
        if(ans == 0) puts("0");
        else printf("%d\n", sum);
    }
    return 0;
}
HDU 1850 Being a Good Boy in Spring Festival 博弈
原文:http://www.cnblogs.com/Hyouka/p/7425346.html