标签:dex namespace lse wchar clu nal pre can --
【题目链接】
http://poj.org/problem?id=1704
【算法】
阶梯博弈
【代码】
#include <algorithm> #include <bitset> #include <cctype> #include <cerrno> #include <clocale> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <exception> #include <fstream> #include <functional> #include <limits> #include <list> #include <map> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stdexcept> #include <streambuf> #include <string> #include <utility> #include <vector> #include <cwchar> #include <cwctype> #include <stack> #include <limits.h> using namespace std; #define MAXN 1010 int i,n,T,s; int a[MAXN]; int main() { scanf("%d",&T); while (T--) { scanf("%d",&n); for (i = 1; i <= n; i++) scanf("%d",&a[i]); a[0] = 0; sort(a+1,a+n+1); if (n & 1) { s = 0; for (i = 1; i <= n; i++) { if (i % 2) s ^= (a[i] - a[i-1] - 1); } if (s) printf("Georgia will win\n"); else printf("Bob will win\n"); } else { s = 0; for (i = 2; i <= n; i++) { if (i % 2 == 0) s ^= (a[i] - a[i-1] - 1); } if (s) printf("Georgia will win\n"); else printf("Bob will win\n"); } } return 0; }
标签:dex namespace lse wchar clu nal pre can --
原文地址:https://www.cnblogs.com/evenbao/p/9302396.html