A year away from parents are worried about
Spring Festival Home Can you do a few days good boy?
Try to do the following things in winter vacation
Spend time with mom on the vegetable
Quietly buy a little gift for dad
Take the initiative to ask for a bowl wash once and for all
One day get up early and give mom and dad a heart for breakfast.
You can talk to Mom and dad if you want.
Let's play a little game. ACM Class to School ~
Here is a two-person mini-game: There are m stacks of poker on the table, and the number of cards per pile is ni (i=1 ... M); The two take turns, and each step can be arbitrarily selected and taken away from any of the cards; the poker on the table is all out, then the game is over; the last person to pick the card is the winner.
Now we do not want to study whether to win or negative, I just want to ask you:
-"If the initiator wants to win, the first step has several options?" ”
Input
The input data contains multiple test cases, each of which occupies 2 rows, and the first line contains an integer m (1<m<=100), which represents the number of stacks of poker, followed by a row containing M integers Ni (1<=ni<=1000000,i=1 ... m), representing the number of M-Heap poker, respectively. An M of 0 indicates the end of the input data.
Output
If the initiator can win, please output his first feasible number of scenarios, otherwise please output 0, each instance output one row.
Sample Input
3
5 7 9
0
Sample Output
1
is the Nimm game; an XOR value greater than the original value can be
#include<iostream>#include<stdio.h>#include<stdlib.h>#include<cmath>#include<string.h>#include<algorithm>#define sf scanf#define pf printf#define pb push_back#define mm(a,b) memset((a),(b),sizeof(a))#include<vector>typedef long long ll;typedef long double ld;const ll mod=1e9+7;using namespace std;const double pi=acos(-1.0);int a[200000];void chuli(int n){ int x=a[0]; for(int i=1;i<n;i++) { x^=a[i]; } if(x==0) { pf("No\n"); }else { pf("Yes\n"); for(int i=0;i<n;i++) { if(a[i]>(a[i]^x)) { pf("%d %d\n",a[i],a[i]^x); } } }}int main(){ int n; while(1) { sf("%d",&n); if(n==0) return 0; mm(a,0); for(int i=0;i<n;i++) sf("%d",&a[i]); chuli(n); }}
H-being a good boy in Spring Festival