UVA-11892(组合游戏)

题意:

给n堆石子,每堆有ai个,每次可以取每堆中任意数目的石子;但是上一次操作的人没有将一堆全部取走,那么下一个人还要在那一堆取;

思路:

每次取到这堆就剩一个的策略;

AC代码:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
//#include <bits/stdc++.h>
#include <stack>

using namespace std;

#define For(i,j,n) for(int i=j;i<=n;i++)
#define mst(ss,b) memset(ss,b,sizeof(ss));

typedef  long long LL;

template<class T> void read(T&num) {
    char CH; bool F=false;
    for(CH=getchar();CH<'0'||CH>'9';F= CH=='-',CH=getchar());
    for(num=0;CH>='0'&&CH<='9';num=num*10+CH-'0',CH=getchar());
    F && (num=-num);
}
int stk[70], tp;
template<class T> inline void print(T p) {
    if(!p) { puts("0"); return; }
    while(p) stk[++ tp] = p%10, p/=10;
    while(tp) putchar(stk[tp--] + '0');
    putchar('\n');
}

const LL mod=1e9+7;
const double PI=acos(-1.0);
const int inf=1e9;
const int N=2e6+10;
const int maxn=500+10;
const double eps=1e-8;


int main()
{       
        int t;
        read(t);
        while(t--)
        {
            int n,a,num=0;
            read(n);
            For(i,1,n)
            {
                read(a);
                if(a==1)num++;
            }
            if(num==n)
            {
                if(n%2)printf("poopi\n");
                else printf("piloop\n");
            }
            else printf("poopi\n"); 

        }
        
        return 0;
}

 

  

posted @ 2016-07-24 21:26  LittlePointer  阅读(172)  评论(0编辑  收藏  举报