Test instructions
Nim question, ask you the first person how many kinds of plan to take
Ideas:
When all is different or complete, then let the value differ or each number
If the result is less than the current number, it means that you can take the different or this number of pebbles from the heap.
Ans on + +
/************************************************author:d evilcreated time:2016/5/29 11:31:46***************** ******************************* */#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>#include<vector>#include<queue>#include<Set>#include<assert.h>#include<map>#include<string>#include<cmath>#include<stdlib.h>using namespacestd;Const intn=1e6+7;intA[n];intMain () {//freopen ("In.txt", "R", stdin); intN; while(~SCANF ("%d", &n) &&N) {intp=0, ans=0; for(intI=0; i<n;i++) {scanf ("%d",&A[i]); P^=A[i]; } for(intI=0; i<n;i++) if((P^a[i]) <A[i]) ans++; printf ("%d\n", ans); } return 0;}
HDU1850 Being a good boy in Spring Festival (NIM stats)