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. Firefox What's New 太难找了

    Firefox每次更新版本,不知道更新了什么,找不到Waht‘s New,做个记录! 1.点击mozilla下拉 2.最左侧 MOZILLA>SUPPORT>Firefox 3.https ...

  2. MM-RGV、AGV 、IGV是什么

    RGV.AGV.IGV是什么 智能化物流仓储设备迅速崛起的时代,RGV.AGV.IGV,这三种看似有血缘关系的智能设备,到底有什么不同呢? RGV RGV即“有轨制导车辆”,又叫有轨穿梭小车,是与地面 ...

  3. jquery下插入标签以及clone的应用

    //内部插入 插入一个儿子 //var $ele = $("<h1></h1>")//创建h1标签 // $ele.html('hello') // $el ...

  4. Masonry 动画

    比如想做一个最简单的位移动画: 关键点在,改完约束后,调用下面这段代码,父view调用 layoutIfNeeded [UIView animateWithDuration:0.5 animation ...

  5. pgsql restart

    /etc/init.d/postgresql restart

  6. pandas 笔记

    删除: del df["A"]  # 原地修改 df.drop("a")  # 返回修改后的新对象 df.drop(["a", " ...

  7. python实现最大重叠子串的查找

    #!/usr/bin/python #查找最大重叠子串 def FindMaxDup(in_str): str_len = len(in_str) result = '' #逐级扩大搜索长度# lev ...

  8. Excel VBA 使用笔记

    开发工具选项卡(Developer Tab) File Tab -> Options -> Customize Ribbon -> Main Tabs -> Developer ...

  9. secureCRT工具下载和安装

    本文主要提供secureCRT软件下载和安装操作指导,节约软件查找和安装时间. 使用环境 32位Windows系统 软件下载 secureCRT软件和注册机下载:secureCRT 安装步骤和注意事项 ...

  10. [PHP]Nginx与PHP的文件上传大小限制

    ---------------------------------------------------------------------------------------------------- ...