Be the Winner

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 2718    Accepted Submission(s): 1487

Problem Description
Let's consider m apples divided into n groups. Each group contains no more than 100 apples, arranged in a line. You can take any number of consecutive apples at one time.

For example "@@@" can be turned into "@@" or "@" or "@ @"(two piles). two people get apples one after another and the one who takes the last is


the loser. Fra wants to know in which situations he can win by playing strategies (that is, no matter what action the rival takes, fra will win).
 
Input
You will be given several cases. Each test case begins with a single number n (1 <= n <= 100), followed by a line with n numbers, the number of apples in each pile. There is a blank line between cases.
 
Output
If a winning strategies can be found, print a single line with "Yes", otherwise print "No".
 
Sample Input
2
2 2
1
3
 
Sample Output
No
Yes
#include <stdio.h>
#include <string.h>
using namespace std;
#define M 50
int num[M];
int main()
{
int i,ans,re,n;
while(scanf("%d",&n)!=EOF)
{
ans=0,re=0;
for(i=0;i<n;i++)
{
scanf("%d",&num[i]);
if(num[i]>1)
ans++;
re^=num[i];
}
if(ans)
{
if(re)
printf("Yes\n");
else
printf("No\n");
}
else
{
if(re)
printf("No\n");
else
printf("Yes\n");
}
}
return 0;
}

hdoj--2509--Be the Winner(尼姆博弈)的更多相关文章

  1. hdu-------(1848)Fibonacci again and again(sg函数版的尼姆博弈)

    Fibonacci again and again Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Jav ...

  2. hdu 1907 (尼姆博弈)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1907 Problem Description Little John is playing very ...

  3. POJ 2234 Matches Game (尼姆博弈)

    题目链接: https://cn.vjudge.net/problem/POJ-2234 题目描述: Here is a simple game. In this game, there are se ...

  4. HDU1907(尼姆博弈)

    John Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submis ...

  5. POJ 3480 &amp; HDU 1907 John(尼姆博弈变形)

    题目链接: PKU:http://poj.org/problem? id=3480 HDU:http://acm.hdu.edu.cn/showproblem.php? pid=1907 Descri ...

  6. hdu 1907 尼姆博弈

    John Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submis ...

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

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

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

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

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

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

  10. HDU 4315 Climbing the Hill (阶梯博弈转尼姆博弈)

    Climbing the Hill Time Limit: 1000MS   Memory Limit: 32768KB   64bit IO Format: %I64d & %I64u Su ...

随机推荐

  1. (转)C#开发微信门户及应用(1)--开始使用微信接口

    http://www.cnblogs.com/wuhuacong/p/3613826.html 微信应用如火如荼,很多公司都希望搭上信息快车,这个是一个商机,也是一个技术的方向,因此,有空研究下.学习 ...

  2. (转)基于MVC4+EasyUI的Web开发框架经验总结(13)--DataGrid控件实现自动适应宽带高度

    http://www.cnblogs.com/wuhuacong/p/4085725.html 在默认情况下,EasyUI的DataGrid好像都没有具备自动宽度的适应功能,一般是指定像素宽度的,但是 ...

  3. servlet向浏览器输出信息

    package com.aaa.servlet; import javax.servlet.ServletException; import javax.servlet.annotation.WebS ...

  4. Nuxt报错

    新增了个文件store.js: //本地存储的工具库 if(!window.localStorage){ alert('你的浏览器不支持localStorage'); } var store ={ s ...

  5. 学习网址Collect

    Laravel 学院    https://laravelacademy.org/wx小程序 https://developers.weixin.qq.com/miniprogram/dev/quic ...

  6. rabbitmq和kafka的区别

    1.吞吐量kafka吞吐量更高: 1)Zero Copy机制,内核copy数据直接copy到网络设备,不必经过内核到用户再到内核的copy,减小了copy次数和上下文切换次数,大大提高了效率. 2)磁 ...

  7. Webpack 快速上手(下)

    杏仁前端开发工程师,代码洁癖症早期,关注前端技术. 由于文章篇幅较长,为了更好的阅读体验,本文分为上.中.下三篇: 上篇介绍了什么是 webpack,为什么需要 webpack,webpack 的文件 ...

  8. 转载:Java中的Checked Exception——美丽世界中潜藏的恶魔?

    转自 Amber-Garden 的 博客 https://www.cnblogs.com/loveis715/p/4596551.html 在使用Java编写应用的时候,我们常常需要通过第三方类库来帮 ...

  9. 9day条件语句和基本数据类型

    1基本数据类型: 字符串‘’," ",''' ''' 单引号,双引号,三引号 加法: n1='ruser' n2='sb' n3=n1+n2 print(n3) 乘法: n1='r ...

  10. 磁盘及文件系统管理(以及btrfs)

    Linux系统管理 磁盘分区及文件系统管理 raid lvm 网络属性管理 程序包管理 sed及awk 进程查看和管理 内核管理(内核的编译和安装) 系统启动流程 定制,编译内核,busybox 系统 ...