Test instructions
Give n heap of stones, each pile of AI, each time can take any number of stones in each heap; But the last one did not take the whole bunch away, then the next person will be in that heap to take;
Ideas:
Every time I get this heap, we have one strategy left.
AC Code:
#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;}
UVA-11892 (combo game)