和之前一道题是类似的,输出第一步走的方法,遍历数组找到a[i]^s<a[i]的那个数a[i]-a[i]^s就是要取的数

#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define pi acos(-1)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=,inf=; int a[N];
int main()
{
ios::sync_with_stdio(false);
cin.tie();
int n;
while(cin>>n,n){
int s=;
for(int i=;i<n;i++)
{
cin>>a[i];
s^=a[i];
}
if(s==)cout<<<<endl;
else
{
int ans=;
for(int i=;i<n;i++)
{
int p=a[i]^s;
if(p<a[i])
ans++;
}
cout<<ans<<endl;
}
}
return ;
}

hdu1850nim博弈输出问题的更多相关文章

  1. hdu2149巴什博弈输出

    一眼就能看出来的巴什博弈,只是要输出第一步取的值,如果m>n+1,输出m%(n+1),否则输出m到n,因为这是第一步 #include<map> #include<set> ...

  2. 【Mark】博弈类题目小结(HDU,POJ,ZOJ)

    转载请注明出处,谢谢http://blog.csdn.net/ACM_cxlove?viewmode=contents    by---cxlove 首先当然要献上一些非常好的学习资料: 基础博弈的小 ...

  3. 博弈论BOSS

    基础博弈的小结:http://blog.csdn.net/acm_cxlove/article/details/7854530 经典翻硬币游戏小结:http://blog.csdn.net/acm_c ...

  4. hdu----(1849)Rabbit and Grass(简单的尼姆博弈)

    Rabbit and Grass Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  5. ACM: NBUT 1107 盒子游戏 - 简单博弈

     NBUT 1107  盒子游戏 Time Limit:1000MS     Memory Limit:65535KB     64bit IO Format:  Practice  Appoint ...

  6. hdu 1849(Rabbit and Grass) 尼姆博弈

    Rabbit and Grass Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  7. Being a Good Boy in Spring Festival 尼姆博弈

    Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Descr ...

  8. HDU 2117 取(2堆)石子游戏【wzf博弈】

    题意:威佐夫博弈原型,除了输出先手能不能胜,还要输出先手的第一手选择. 思路:预处理出1000000以内的所有奇异局势.对于每个自然数,其必然是某一个奇异局势的a或者b.故对于一个非奇异局势,必定有一 ...

  9. HDU 1846 Brave Game(巴什博弈)

    题目链接: 传送门 Brave Game Time Limit: 1000MS     Memory Limit: 65536K 题目描述 各位勇敢者要玩的第一个游戏是什么呢?很简单,它是这样定义的: ...

随机推荐

  1. asp.net mvc(一) ----------简单封装成通用的List<T>集合

    asp.net mvc(一) 这些天开始学习asp.net mvc,用传统的asp.net已经快四的年了,刚开始接触asp.net mvc确认感觉有点不适应,主要体现在asp.net mvc的实现上. ...

  2. 关于string的length

    在C++里面,std::string的length()返回的是字节数,与编码方式有关. int main() { std::string s = "我是中国人"; std::cou ...

  3. Convolution and polynomial multiplication

    https://www.mathworks.com/help/matlab/ref/conv.html?s_tid=gn_loc_drop conv Convolution and polynomia ...

  4. OpenPGP协议的一个JavaScript实现:OpenPGP.js

    OpenPGP.js 是OpenPGP协议的一个Javascript实现. 基于 JavaScript的OpenPGP实现方便用户可以直接在浏览器中加密和解密Web邮件,不需要专门的邮件客户端.

  5. (1.4)DML增强功能-Output

    Output在CRUD的区别 1.对于INSERT,可以引用inserted表以查询新行的属性.在insert into table output . 2.对于DELETE,可以引用deleted表以 ...

  6. POJ1175:Starry Night(bfs)

    http://poj.org/problem?id=1175 题目解析: 这个题因为数据的原因可以很水的过,但我因为把1e-8写成了1e-9WA了N遍,一直WA,题目意思很简单就是相似图形(就是求旋转 ...

  7. CentOS6.9安装httpd并正确配置静态IP地址

    题目要求 在vmware中安装一台虚拟机,操作系统为centos6.9 ip地址为 192.168.56.11 要求: 1.xshell能够连接上此虚拟机 2.此虚拟机必须可以上网 3.使用yum安装 ...

  8. PAT 1082 Read Number in Chinese[难]

    1082 Read Number in Chinese (25 分) Given an integer with no more than 9 digits, you are supposed to ...

  9. python16_day36【爬虫1】

    一.requests 1. GET请求 # 1.无参数实例 import requests ret = requests.get('https://github.com/timeline.json') ...

  10. mongodb安装及副本集搭建

    mongodb下载地址:https://www.mongodb.com/dr/fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.2.7.tg ...