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. MVC基于角色权限控制--权限过滤

    用户访问服务器实际上就是访问控制器下的方法,因此在权限控制就是控制器方法的访问权限 为了方便控制,我们可以建立一个基类控制器(BaseController),让需要的控制器继承这个控制器即可,在Bas ...

  2. 关于 roadhog 2.0 版本之后不支持 cssModulesExclude

    cssModulesExclude 是用于 cssModules模块之后 ,解决不需要 cssModules 模块的样式文件, 了解 cssModules 看这里 https://segmentfau ...

  3. 机器学习进阶-图片基本处理-ROI区域 1.img[0:200, 0:200]截取图片 2.cv2.split(对图片的颜色通道进行拆分) 3. cv2.merge(将颜色通道进行合并) 4 cur_img[:, :, 0] = 0 使得b通道的颜色数值为0

    1. 截取图片的部分区域img[0:200, 0:200], 读入的图片是ndarray格式 2. b, g, r = cv2.split(img)  # 对图片的颜色通道进行拆分 3.img = c ...

  4. jeecg好用吗,看看大家的评价

    大家都会有个疑问,jeecg好用吗? 看看大家的评价

  5. android的体系结构

    android 体系结构:采用软件堆层的架构 ,四层1应用程序“: 提供一系列的核心应用程序 2应用程序框架 :提供安卓平台基本的管理功能和组件重用机制activityManager 管理应用程序的生 ...

  6. 2312--1.3.4 Prime Cryptarithm 牛式

    Description 下面是一个乘法竖式,如果用我们给定的那n个数字来取代*,可以使式子成立的话,我们就叫这个式子牛式. * * * x * * ------- * * * * * * ------ ...

  7. 原生js上传文件,使用new FormData()

    当创建一个内容较多的表单,表单里面又有了文件上传,文件上传也需要表单提交,单一的上传文件很好操作: <form action="接口" enctype="multi ...

  8. AngularJS理论知识

    两个核心概念 三个架构 MVC 一切应用程序都是数据的增删改查 那么总要有东西装数据吧 Model就是干这个事(数据表现和操作) View(展现数据) Controller(逻辑) 那么M- V- C ...

  9. tomcat架构分析(valve机制)

    关于tomcat的内部逻辑单元的存储空间已经在相关容器类的blog里阐述了.在每个容器对象里面都有一个pipeline及valve模块. 它们是容器类必须具有的模块.在容器对象生成时自动产生.Pipe ...

  10. php分割最后一个逗号后面的字符

    $str = 'a/b/c/d/e/f'; echo preg_replace('/.*\//','',$str);     echo preg_replace('/.*,/','',$str);最后 ...