Topic Link: Click to open the link
Test instructions: N pieces distributed on the x positive half axis, now two people take turns to the left to move the pieces, the request can not touch other pieces can not cross the border (can not move to the negative half axis), and finally can not move the people worship.
Equivalent to a ladder game, such as 2 5 7 9, if 5 to the left to 3 (moved 2), then the range of 7 can be moved to increase the two lattice.
The concrete ladder game's understanding to see here: click Open link
Note: The rightmost ladder is equivalent to the number 1, not the leftmost one. (because it always moves to the left) also, the question to sort ...
#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 1002#define _ll __int64#define ll Long long#define INF 0x3f3f3f3f#define Mod 10000007#define pp pair<int,int> #define ull unsigned long longusing names Pace std;int n,a[maxn];void Solve () {a[0]=0;int tem=0;for (int i=1;i<=n;i++) {scanf ("%d", a+i);} Sort (a,a+n+1); for (int i=n;i>=1;i-=2) {int d=a[i]-a[i-1]-1;tem^=d;} if (TEM) puts ("Georgia'll Win"), Else puts ("Bob would win"); int main () {int t;scanf ("%d", &t), while (t--) {scanf ("%d", &n); solve ();} return 0;}
POJ 1704-georgia and Bob (ladder game)