# Being a Good Boy in Spring Festival

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 6824    Accepted Submission(s): 4134

Problem Description

——“先手的人如果想赢，第一步有几种选择呢？”

Input

Output

Sample Input
3 5 7 9 0

Sample Output
1

//
//  main.cpp
//  HDU1850
//
//  Created by teddywang on 2016/8/30.
//

#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,s[103];
int main()
{
while(cin>>n&&n)
{
int ans=0;
for(int i=0;i<n;i++)
{
scanf("%d",&s[i]);
ans^=s[i];
}
if(ans==0)
{
cout<<0<<endl;
continue;
}
int cnt=0;
for(int i=0;i<n;i++)
{
int buf=s[i]^ans;
if(buf<=s[i]) cnt++;
}
cout<<cnt<<endl;
}
}

• 本文已收录于以下专栏：

## hdu1850 Being a Good Boy in Spring Festival（nim博弈）

Being a Good Boy in Spring Festival Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/3...
• d_x_d
• 2016年08月05日 00:04
• 633

## HDU-1850-Being a Good Boy in Spring Festival【Nim博弈】

Being a Good Boy in Spring FestivalProblem Description 题目大意：Nim问题，有N堆各若干个物品，两个人轮流从某一堆取任意多的物品，规定每次至少...

## [ACM] hdu 1850 Being a Good Boy in Spring Festival（Nim博弈）

Being a Good Boy in Spring Festival Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/3...

## HDU 1850 - Being a Good Boy in Spring Festival【Nim博弈】

Being a Good Boy in Spring Festival Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/3...

## HDU 1850 Being a Good Boy in Spring Festival【标准Nim博弈，先手赢的方案数】

Being a Good Boy in Spring Festival Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/3...

## HDU 1850 Being a Good Boy in Spring Festival（Nim博弈）

• 2015年07月24日 11:22
• 212

## HDU 1850-Being a Good Boy in Spring Festival(Nim博弈)

Being a Good Boy in Spring Festival Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32...
• MIKASA3
• 2016年05月09日 20:05
• 299

## hdu 1850 Being a Good Boy in Spring Festival （Nim博弈求第一步走法数）

Being a Good Boy in Spring FestivalTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/327...

## HDU 1850 Being a Good Boy in Spring Festival 博弈Nim游戏

Being a Good Boy in Spring Festival Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/3...

举报原因： 您举报文章：HDU1850 Being a Good Boy in Spring Festival Nim博弈 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)