1.Problem
http://poj.org/problem?id=2975
2.Idea
Calculate Nim.
3.Source
int n;
int a[1100];
void solve()
{
while (scanf("%d", &n)) {
if (n == 0) break;
int x = 0;
REP(i, n) {
scanf("%d", &a[i]);
x ^= a[i];
}
int ans = 0;
if (x > 0) {
REP(i, n) {
int tmp = x ^ a[i];
if (tmp <= a[i]) ans++;
}
}
printf("%d\n", ans);
}
}
No comments:
Post a Comment