Topic Link: UVA 11892-enimen
The main topic: Given the number of stones in the N heap, the two take turns to choose stones to heap stones, until they can not be taken as a failure, additional conditions, assuming the previous operation, that is, the operation of the team hand, not the selected stone heap in the stone to take, then the current operator must be in the heap to take stones.
Problem-solving ideas: only to have a stone heap number is greater than 2, then the initiator will win the state, controllable. The parity is inferred for all 1 cases.
#include <cstdio>#include <cstring>#include <algorithm>using namespace STD;BOOLJudge () {intn, X;BOOLFlag =false;scanf("%d", &n); for(inti =0; I < n; i++) {scanf("%d", &x);if(X >1) flag =true; }returnFlag | | (n&1);}intMain () {intCAsscanf("%d", &cas); while(cas--) {BOOLFlag = judge ();printf("%s\n", Flag?"Poopi":"Piloop"); }return 0;}
UVA 11892-enimen (Inference)