POJ 1704-Georgia and Bob (Tiered game)
N pawns are distributed on the x-axis. Now the two move the pawns to the left in turn. They must not cross the border when they encounter other pawns (they cannot be moved to the negative half-axis.
It is equivalent to a tiered game. For example, if 5 moves to the left to 3 (2 cells are moved), the range of 7 moves increases by two cells.
For more information about the tiered game, click here.
Note: the rightmost step is equivalent to 1, not the leftmost step. (Because it always moves to the left) and this question should be sorted...
#include #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define maxn 1002#define _ll __int64#define ll long long#define INF 0x3f3f3f3f#define Mod 10000007#define pp pair
#define ull unsigned long longusing namespace 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 will win);else puts(Bob will win);}int main(){int T;scanf(%d,&T);while(T--){scanf(%d,&n);solve();}return 0;}