Matches Game

http://poj.org/problem?id=2234

Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 12309   Accepted: 7172

Description

Here is a simple game. In this game, there are several piles of matches and two players. The two player play in turn. In each turn, one can choose a pile and take away arbitrary number of matches from the pile (Of course the number of matches, which is taken away, cannot be zero and cannot be larger than the number of matches in the chosen pile). If after a player’s turn, there is no match left, the player is the winner. Suppose that the two players are all very clear. Your job is to tell whether the player who plays first can win the game or not.

Input

The input consists of several lines, and in each line there is a test case. At the beginning of a line, there is an integer M (1 <= M <=20), which is the number of piles. Then comes M positive integers, which are not larger than 10000000. These M integers represent the number of matches in each pile.

Output

For each test case, output "Yes" in a single line, if the player who play first will win, otherwise output "No".

Sample Input

2 45 45
3 3 6 9

Sample Output

No
Yes
 #include<iostream>
using namespace std;
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define sqr(x) ((x)*(x))
#define maxn 100005
typedef long long ll;
typedef unsigned long long ull;
const ull MOD=;
/*#ifndef ONLINE_JUDGE
freopen("1.txt","r",stdin);
#endif */ int a[]; int main(){
#ifndef ONLINE_JUDGE
// freopen("1.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
int n;
while(cin>>n){
int ans=;
for(int i=;i<=n;i++) {
cin>>a[i];
ans^=a[i];
}
if(!ans) cout<<"No"<<endl;
else cout<<"Yes"<<endl; }
}

Matches Game的更多相关文章

  1. keil MDK error: L6236E: No section matches selector - no section 错误

    今天板子刚到,新建的第一个工程就报错了. .\Objects\cse.sct(7): error: L6236E: No section matches selector - no section t ...

  2. 解决Android中No resource found that matches android:TextAppearance.Material.Widget.Button.Inverse问题

    解决Android中No resource found that matches android:TextAppearance.Material.Widget.Button.Inverse问题http ...

  3. HDU5456 Matches Puzzle Game(DP)

    题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5456 Description As an exciting puzzle game for ...

  4. Matches正则使用提取内容

    用VS新建WinForm程序,窗体上是三个文本框和一个按钮.可以自己构造正则表达式,自己修改匹配内容 正则表达是要提取的部分为hewenqitext 代码如下: using System; using ...

  5. js之 matches (可以取代jq的 delegate 方法)

    问题:请给#wrap 下面的子元素添加点击事件! <div id="wrap"> <a class="btn" href="http ...

  6. Owin SelfHost Asp.net WebApi 遇到 No type was found that matches the controller named 'ControllerName' 异常的解决方案

    问题背景:在使用普通的SelfHost时,调用其它工程的dll(其实就是把WebApi写到一个单独的工程方便管理),通过加载其他工程的dll然后再访问webapi是没有问题的. 但是在使用Owin S ...

  7. uva 11357 Matches

    // uva 11357 Matches // // 题目大意: // // 给你n个火柴,用这n个火柴能表示的非负数有多少个,不能含有前导零 // // 解题思路: // // f[i] 表示正好用 ...

  8. android中出现Error retrieving parent for item: No resource found that matches the Theme.AppCompat.Light

    styles.xml中<style name="AppBaseTheme" parent="Theme.AppCompat.Light">提示如下错 ...

  9. error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.

    error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCom ...

  10. No resource found that matches the given name 'Theme.AppCompat.Light 的完美解决方案

    No resource found that matches the given name 'Theme.AppCompat.Light 的完美解决方案 首先这个问题的产生是由于缺少Theme.App ...

随机推荐

  1. sql server的缺陷 将截断字符串或二进制数据 哪个字段

    将截断字符串或二进制数据 哪个字段 消息 8152,级别 16,状态 14,第 2 行将截断字符串或二进制数据. sql server2000 sql server2014 也不能直接提示出哪个字段的 ...

  2. ACM__并查集

    并查集是树型的数据结构,处理不想交集合 主要解决查找和合并的问题 步骤: 初始化 把每个点所在的集合初始化为自身 复杂度为O(N) 查找 查找元素所在的集合,即根节点 合并 将两个元素所在的集合合并在 ...

  3. 利用nginx搭建RTMP视频点播、直播、HLS服务器(转)

    开发环境 Ubuntu 14.04 server nginx-1.8.1 nginx-rtmp-module nginx的服务器的搭建 安装nginx的依赖库 sudo apt-get update ...

  4. Angular2学习笔记

    Angular2 这里 Angular2 是指采用 TypeScript 语言的 Angular 2.0及以上版本.与采用 JavaScript 语言的 AngularJS 相比,Angular2 不 ...

  5. 转: python requests的安装与简单运用

    requests是Python的一个HTTP客户端库,跟urllib,urllib2类似,那为什么要用requests而不用urllib2呢? 官方文档中是这样说明的: python的标准库urlli ...

  6. Shell编程常用函数

    1.打印提示消息函数,不同级别消息使用不同的颜色显示.其中错误信息提示为红色字体. # -------------------------------------------------------- ...

  7. t959 unknown device 解决办法

    换机器没用 换数据线没用 最后装了Kies3,好了! -------- 更新 跟数据线也有关系 换一条三星自带的试试

  8. [Nginx]实战Nginx:Nginx服务器的安装与配置

    ----------------------------------------------------------------------------------------------- Ngin ...

  9. 整合mybaties 逆向生成 pojo mapper.xml

    第一步:配置properties 第二步:放入generatorConfig.xml文件  在总目录下  这个是生成工具 第三步:放入工具类,自动生成用的,  pom里面要加入6个依赖 第四步:运行u ...

  10. java解决查找问题

    1.给定一个字符串,找到里面的大写字母和小写字母以及其他字母的个数: 代码: package test; public class Stringclass { public static void m ...