Being a good boy in Spring Festival
Time limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 7841 Accepted Submission (s): 4811
Problem description A year outside parents time
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?" 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 export his first feasible number of scenarios, otherwise please output 0, the output of each instance takes up one row. Sample Input35 7 90
Sample OUTPUT1 Actually this pit your parents do you have the heart? Upgrade version of this problem http://www.cnblogs.com/Hyouka/p/7425334.html
#include <iostream> #include <cstring> #include <cstdio># Include <algorithm> #include <queue> #include <vector> #include <iomanip> #include <math.h > #include <map>using namespace std; #define FIN freopen ("Input.txt", "R", stdin), #define FOUT freopen ("Output . txt "," w ", stdout), #define INF 0x3f3f3f3f#define infll 0x3f3f3f3f3f3f3f#define lson l,m,rt<<1#define Rson M+1,r,rt<<1|1typedef Long Long ll;typedef pair<int, int> pii;using namespace Std;int a[105];int Main () {/ /fin int n; while (~SCANF ("%d", &n) && n) {int ans = 0; int sum = 0; for (int i = 1; I <= n; i++) {scanf ("%d", &a[i]); Ans ^= a[i]; } for (int i = 1; I <= n; i++) {if ((ans ^ a[i]) < a[i]) sum++; } if (ans = = 0) puts ("0"); else printf ("%d\n", sum); } return 0;}
HDU 1850 Being A good boy in Spring Festival game