zoukankan      html  css  js  c++  java
  • HDU2509 Be the Winner(反NIM)

    题意:

    N堆苹果,先取完的输。。

    思路:

    反NIM

    先手获胜的条件是所有堆都为1并且异或值为0

    或者有的堆大于1并且异或值不为0

    /* ***********************************************
    Author        :devil
    Created Time  :2016/5/30 17:35:45
    ************************************************ */
    #include <cstdio>
    #include <cstring>
    #include <iostream>
    #include <algorithm>
    #include <vector>
    #include <queue>
    #include <set>
    #include <map>
    #include <string>
    #include <cmath>
    #include <stdlib.h>
    using namespace std;
    int main()
    {
        //freopen("in.txt","r",stdin);
        int n,x;
        while(~scanf("%d",&n))
        {
            int f=0,s=0;
            while(n--)
            {
                scanf("%d",&x);
                s^=x;
                if(x>1) f=1;
            }
            if(s&&f||!s&&!f) printf("Yes
    ");
            else printf("No
    ");
        }
        return 0;
    }
  • 相关阅读:
    前端技术-PS切图
    Html5资料整理
    Html5知识体系
    Html知识体系
    C语言知识结构
    ASP.NET知识结构
    src和href的区别
    Ajax的简单使用
    学习理论
    求模运算法则
  • 原文地址:https://www.cnblogs.com/d-e-v-i-l/p/5543297.html
Copyright © 2011-2022 走看看