hdu2509
来源:互联网 发布:数据交换接口规范 编辑:程序博客网 时间:2024/06/08 10:36
Be the Winner
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 593 Accepted Submission(s): 296
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).
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
22 213
Sample Output
NoYes
#include<stdio.h>
using namespace std;
int main()
{
int n;
while(scanf("%d",&n)==1)
{
int sum=0;
int u,k=0;
for(int i=0;i<n;i++)
{
cin>>u;
sum=sum^u;
if(u>1)k++;
}
if(k==0)
{
if(n%2==0)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
else
{
if(sum==0)cout<<"No"<<endl;
else cout<<"Yes"<<endl;
}
}
return 0;
}
- hdu2509
- hdu2509
- anti_nim反尼姆博弈 hdu2509
- hdu2509 Be the Winner
- Hdu2509 反NIM博弈
- HDU2509 Be the Winner 博弈
- HDU2509:Be the Winner(Nim)
- HDU2509 Nim博弈 附定理
- hdu2509 Be the Winner (尼姆博弈)
- HDU2509 Be the Winner Nim博弈
- Hdu 1907 && Hdu2509 (nim博弈的相反胜况)
- hdu2509 Be the Winner(博弈论---尼姆博弈)
- [HDU2509]Be the Winner(博弈Anti-SG+Multi-SG游戏)
- 第一章、左旋转字符串
- Socket 编程 windows到Linux代码移植遇到的问题
- 大家好 ,
- JAVASCRIPT正则中的RegExp.$1
- 深入理解C语言指针的奥秘
- hdu2509
- Immutable class
- hdu1058
- oracle11g- expdp/impdp
- 杭电 2544 最短路 Dijkstra算法
- Godaddy上ASP.net导出excel的方法
- hdu2616 kill the monster 4.3.8
- 探秘PHP 5的对象重载技术
- Android实战技巧:组件间通信---Intent和IntentFilter