【题目链接】

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 = ; i <= n; i++) scanf("%d",&a[i]);
a[] = ;
sort(a+,a+n+);
if (n & )
{
s = ;
for (i = ; i <= n; i++)
{
if (i % )
s ^= (a[i] - a[i-] - );
}
if (s) printf("Georgia will win\n");
else printf("Bob will win\n");
} else
{
s = ;
for (i = ; i <= n; i++)
{
if (i % == )
s ^= (a[i] - a[i-] - );
}
if (s) printf("Georgia will win\n");
else printf("Bob will win\n");
}
} return ; }

【POJ 1704】 Georgia and Bob的更多相关文章

  1. 【poj 1704】Georgia and Bob

    Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 9776 Accepted: 3222 Description Georgia a ...

  2. 【POJ】【1704】Georgia and Bob

    组合游戏 Nim游戏的一个变形 题解请看金海峰的博客 以下为引用: 分析:我们把棋子按位置升序排列后,从后往前把他们两两绑定成一对.如果总个数是奇数,就把最前面一个和边界(位置为0)绑定. 在同一对棋 ...

  3. 【POJ1704】Georgia and Bob(博弈论)

    [POJ1704]Georgia and Bob(博弈论) 题面 POJ Vjudge 题解 这种一列格子中移动棋子的问题一般可以看做成一个阶梯博弈. 将一个棋子向左移动时,它和前面棋子的距离变小,和 ...

  4. bzoj 2295: 【POJ Challenge】我爱你啊

    2295: [POJ Challenge]我爱你啊 Time Limit: 1 Sec  Memory Limit: 128 MB Description ftiasch是个十分受女生欢迎的同学,所以 ...

  5. 【链表】BZOJ 2288: 【POJ Challenge】生日礼物

    2288: [POJ Challenge]生日礼物 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 382  Solved: 111[Submit][S ...

  6. BZOJ2288: 【POJ Challenge】生日礼物

    2288: [POJ Challenge]生日礼物 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 284  Solved: 82[Submit][St ...

  7. BZOJ2293: 【POJ Challenge】吉他英雄

    2293: [POJ Challenge]吉他英雄 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 80  Solved: 59[Submit][Stat ...

  8. BZOJ2287: 【POJ Challenge】消失之物

    2287: [POJ Challenge]消失之物 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 254  Solved: 140[Submit][S ...

  9. BZOJ2295: 【POJ Challenge】我爱你啊

    2295: [POJ Challenge]我爱你啊 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 126  Solved: 90[Submit][Sta ...

随机推荐

  1. C - Valera and Fruits

    Problem description Valera loves his garden, where n fruit trees grow. This year he will enjoy a gre ...

  2. c语言open()介绍

    2013-09-0914:40:13 1. 头文件: #include <sys/types.h> #include <sys/stat.h> #include <fcn ...

  3. 使用Flask和Bootstrap构建博客系统(1) - 准备篇

    技术栈 macOS10.12.5 Python2.7.13 Bootstrap4.0.0-beta.2 virtualenv virtualenvwrapper 安装Python2.7.13 下载Bo ...

  4. WP - 控件基础-按钮控件

    Button:HyperlinkButton:RepeatButton:ToggleButton 1.Button:    <button content="Button" ...

  5. 实践:使用FLANN.LSH进行检索

    1.Survey: FLANN 库详情见:http://en.wikipedia.org/wiki/Flann http://medievalscotland.org/kmo/AnnalsIndex/ ...

  6. 几个方便编程的C++特性

    前言: C++11的自动化特性给编程提供了不少方便,同时也给调试增加了很多负担,至于取舍看程序员的风格和侧重而定. auto:自动类型推断 在C++11之前,auto关键字用来指定存储期.在新标准中, ...

  7. 基于MapReduce的贝叶斯网络算法研究参考文献

    原文链接(系列):http://blog.csdn.net/XuanZuoNuo/article/details/10472219 论文: 加速贝叶斯网络:Accelerating Bayesian ...

  8. What are lazy variables?

    Written by Paul Hudson     @twostraws It's very common in iOS to want to create complex objects only ...

  9. C#结束Explorer进程

    private void Form1_Load(object sender, EventArgs e) { Process[] processes = Process.GetProcesses();/ ...

  10. VS Code中编写html(5) 标签的布局设置

    1  <!--首先在div中添加四个span标签--> <div> <!--span*4+tab--> <!--span{span$}*4--> < ...