【题目链接】

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. js+css模仿打字效果

    1.效果 2.源码 <%@ page contentType="text/html;charset=UTF-8" language="java" %> ...

  2. 30秒就能理解的JavaScript优秀代码

    数组 arrayMax 返回数组中的最大值. 将Math.max()与扩展运算符 (...) 结合使用以获取数组中的最大值. const arrayMax = arr => Math.max(. ...

  3. javascript中构造函数的三种方式

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  4. Python 之 面向对象(一)

    一.dir内置函数 在标识符/数据后输入一个.,然后按下TAB键,ipython会 提示该对象能够调用的方法列表 使用内置函数dir传入标识符/数据后,可以查看对象内所有的属性及方法 #查看注释 de ...

  5. Lazy Stored Properties--无括号时为匿名函数

    第一次使用的时候进行计算和初始化,后面的引用不在进行计算. A lazy stored property is a property whose initial value is not calcul ...

  6. python tips:生成器的小问题

    在Python中,生成器和函数很像,都是在运行的过程中才会去确定各种变量的值,所以在很多情况下,会导致各种各样的问题. def generator_test1(): # 0...9 generator ...

  7. vc++如何创建程序-构造函数

    如果给Animal带参,则提示没有缺省的构造函数了,缺省就是不带参数的 改进:从子类当中向基类传递代参的,这样他就会给Animal传递400,300 对一个常量来调用 #include<iost ...

  8. 503是一种HTTP状态码。英文名503 Service Unavailable与404(404 Not Found)是同属一种网页状态出错码。前者是服务器出错的一种返回状态,后者是网页程序没有相关的结果后返回的一种状态,需要优化网站的时候通常需要制作404出错页以便网站整体优化。

    goldCat1 商城 消息 | 百度首页 新闻网页贴吧知道音乐图片视频地图百科文库 进入词条搜索词条帮助 近期有不法分子冒充官方收费编辑词条,百度百科严正声明:百科词条人人可编辑,词条创建和修改均免 ...

  9. sql2008删除语句.txt

    delete from [aixinxing].[dbo].[bbs2] where announceID in (select AnnounceID from [aixinxing].[dbo].[ ...

  10. UVA227 - Puzzle(紫书习题3.5)

    #include <algorithm> #include <iostream> #include <cstdlib> #include <cstring&g ...