POJ 2234 尼姆博奕

简介:

n堆各若干个物品,两个人轮流从某一堆取任意多的物品,规定每次至少取一个,多者不限,最后取光者得胜.

任何奇异局势(a1, a2, … , an)都有a1(+)a2(+)…(+)an=0.  ( (+)为 按位与)

#include <iostream>
#include<cstdio>
using namespace std;

int main()
{
    int n,m,sum;
    while(~scanf("%d",&n))
    {
        for(int i=0; i<n; i++)
        {
            scanf("%d",&m);
            if(i<1) sum=m;
            else sum=sum^m;
        }
        if(sum)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}


目录
相关文章
|
9月前
POJ-2245-Lotto
POJ-2245-Lotto
45 0
F-POJ-3414 Pots
POJ-3414 Time Limit:1000 ms Memory Limit:65536 K Description You are given two po...
1009 0
POJ 1067 取石子游戏
取石子游戏 Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 40917   Accepted: 13826 Description 有两堆石子,数量任意,可以不同。
1131 0
poj 3620
题意:给出一个矩阵,其中有些格子干燥、有些潮湿。       如果一个潮湿的格子的相邻的四个方向有格子也是潮湿的,那么它们就可以构成更大       的湖泊,求最大的湖泊。       也就是求出最大的连在一块儿的潮湿的格子的数目。
584 0
poj 1455
Description n participants of > sit around the table. Each minute one pair of neighbors can change their places.
626 0
POJ 2487 Stamps
Description Background Everybody hates Raymond. He’s the largest stamp collector on planet earth and because of that he always makes fun of all the others at the stamp collector parties.
1077 0
POJ 2262 Goldbach&#39;s Conjecture
Problem Description In 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the foll...
1024 0
poj题目分类
http://www.cnblogs.com/kuangbin/archive/2011/07/29/2120667.html
780 0