Topic Link: Click to open the link
Test instructions: 2 people game problem.
There are two identical boxes, One of them has n balls and the other one is loaded with a ball. Alice and Bob invented a game with the following rules:
Alice and Bob take turns, and Alice operates first. For each operation, the player first looks at the number of balls in the box, then empties the box (the ball in the box is thrown away), and then takes the ball from the other box to the box so that two boxes have at least one ball. If a player is unable to operate, he or she loses.
One place to compare pits is when two stacks of items are the same, you can take any pile instead of just losing it. Visible (a) is the final state. Push to find that when N is 2^m-1 Bob wins, anyway Alice will win.
#include <algorithm> #include <iostream> #include <cstring> #include <cstdlib> #include < string> #include <cctype> #include <vector> #include <cstdio> #include <cmath> #include < queue> #include <stack> #include <map> #include <set> #define MAXN 10100#define _ll __int64#define ll Long long#define INF 0x3f3f3f3f#define Mod 1000000007#define pp pair<int,int> #define ull unsigned long longusing nam Espace std;int n;int Main () {while (scanf ("%d", &n)!=eof&&n) {++n;while (!) ( n&1)) n>>=1;if (n==1) puts ("Bob"), Else puts ("Alice"); return 0;}
Sdut 3004-Box game (game)