POJ 1704-georgia and Bob (ladder game)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.