题目大意:输入一个整数n,表示火柴堆数(原题其实指的是苹果堆数,但是为了尽量与模板保持一致,所以在这里理解为火柴堆数。。。。其实理解为什么都没关系,

重要的是,理解就行。。。。)。在接下来的一行中,有n个数字,表示每个火柴堆的火柴根数。

解题思路:还是去火柴棒的问题

详细的说明请参考上一篇博客

代码如下:

/*
* 2509_1.cpp
*
* Created on: 2013年9月1日
* Author: Administrator
*/ #include <iostream> using namespace std; int main(){
int sum1;
int sum2;
int ans; int n;
while(scanf("%d",&n) != EOF){
sum1 = 0;
sum2 = 0;
ans = 0; int a[n];
int i;
for(i = 0 ; i < n ; ++i){
scanf("%d",&a[i]); if(a[i] >= 2){
sum1++;
}else{
sum2++;
} ans ^= a[i];
} if( (ans != 0 && sum1 != 0) || (ans == 0 && sum1 == 0) ){
printf("Yes\n");
}else{
printf("No\n");
}
}
}

(step8.2.2)hdu 2509(Be the Winner——简单博弈)的更多相关文章

  1. HDU 2509 Be the Winner nim博弈变形

    Be the Winner Problem Description   Let's consider m apples divided into n groups. Each group contai ...

  2. hdu 1907 John&& hdu 2509 Be the Winner(基础nim博弈)

    Problem Description Little John is playing very funny game with his younger brother. There is one bi ...

  3. hdu 2509 Be the Winner(anti nim)

    Be the Winner Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tot ...

  4. hdu 2509 Be the Winner 博弈论

    博弈论水题!!! 代码如下: #include<stdio.h> #include<iostream> using namespace std; int main(){ int ...

  5. hdu 2509 Be the Winner 博弈

    题目链接 有n堆苹果, 对于其中的每一堆的x个苹果, 它是放在一条线上的. 你每次可以对一堆苹果进行操作, 可以取y个, 1<=y<=x. 然后如果你是取的一条线上中间的苹果, 那么这一堆 ...

  6. HDU 2509 Be the Winner(取火柴博弈2)

    传送门 #include<iostream> #include<cstdio> #include<cstring> using namespace std; int ...

  7. HDU 4642 Fliping game (简单博弈)

    Fliping game Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tota ...

  8. HDU 3951 Coin Game (简单博弈)

    Coin Game Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total S ...

  9. hdu 2999 sg函数(简单博弈)

    Stone Game, Why are you always there? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/ ...

随机推荐

  1. 在VC6中基于dll开发插件用于各种图片显示(BMP/TGA/JPG/GIF/PNG/TIF/ICO/WMF/EMF/...)

    一.图片显示 图片显示的方法: 1.  直接写程序 2.  第3方库 3.  调用COM组件的IPicture接口 4.  使用MFC的CPictureHolder类 5.  使用GDI+的CImag ...

  2. zookeeper集群搭建设置

    zookeeper 官网:http://zookeeper.apache.org/ 现在最新版本是 3.4.6 ,但是这个版本我没有运行起来,可能是那配置出现问题了,现在我用的是3.4.5 http: ...

  3. hdoj 1874 畅通工程续(单源最短路+dijkstra)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1874 思路分析:该问题给定一个无向图.起始点和终点,要求求出从起始点到终点的最短距离: 使用Dijks ...

  4. Hidden String(深搜)

    Hidden String Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) ...

  5. python下异常处理

    1.python下异常如何处理: #encoding=utf-8 """ python遇到异常,程序直接运行 try: "判断有可能抛出异常的代码" ...

  6. onpagehide、onunload 和 onpageshow、onload事件疑惑

    今天在最新版本chrome浏览器中测试在什么情况下会触发onpagehide.onunload事件(点击一个链接,刷新页面,提交表单,关闭浏览器等).测试代码粘贴如下: <!DOCTYPE ht ...

  7. La=LaULb (循环链表)

    #include<stdio.h> typedef struct LNode { int data; struct LNode *next; }LNode,*LinkList; void ...

  8. python中的字符串和数字连接

    1. 将数字强制转换成字符串 i = 1000 str1 = "hello" print str1 + str(i) 2. 格式化成字符串 i = 1000 str1 = &quo ...

  9. Niagara技术文档汇总

    Niagara技术文档汇总http://wenku.baidu.com/view/ccdd4e2c3169a4517723a38f.html Niagara讲解要点http://wenku.baidu ...

  10. cocos2dx进阶学习之屏幕适配

    背景 在学习cocos2dx时,我们在main函数中发现一句代码, #include "main.h" #include "AppDelegate.h" #in ...