POJ 1704
来源:互联网 发布:吉利知豆d3多少钱 编辑:程序博客网 时间:2024/06/05 16:45
软院校赛的题目,比赛的时候欢快的过了30+队伍,果然还是差距颇大OTZ。
这题是nim游戏的变形。如果先把第i颗棋子向左移动,那么第i+1颗棋子也可以向左移动相同的格子数,所以第i颗棋子据左边的距离是不影响游戏结果的,真正影响游戏结果的是第i颗棋子与第i+1颗棋子的距离,即把p[i]-p[i-1]看做石子的个数做nim游戏。
#define _CRT_SECURE_NO_DEPRECATE#include<iostream>#include<cstdio>#include<algorithm>#include<string>#include<cstring>#include<queue>#include<vector>#include<cmath>#include<ctime>#define mx 200005#define LL long long #define mod 1000000009#define esp 1e-12#define y1 y1234#define inf 0x3f3f3f3f#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1const double PI = acos(-1.0);using namespace std;int a[1005];int main(){int t;cin >> t;while (t--){int n;cin >> n;for (int i = 1; i <= n; i++){scanf("%d", &a[i]);}sort(a + 1, a + n + 1);int ans = 0;for (int i = n; i > 0; i -= 2){ans = ans ^ (a[i] - a[i - 1] - 1);}if (ans)printf("Georgia will win\n");else printf("Bob will win\n");}return 0;}
0 0
- poj 1704
- poj 1704
- POJ 1704
- POJ 1704
- POJ 1704
- poj-1704
- 【POJ】1704
- poj 1704 阶级博弈
- 阶梯博弈(poj 1704)
- poj 1704 (阶梯博弈)
- POJ 1704 StaircaseNim
- poj-1704 nim变形
- POJ 1704 (博弈)
- poj 1704 阶梯博弈
- POJ
- poj
- POJ
- POJ
- fill-parent、match-parent与wrap-content区别
- Android开发环境搭建
- 虚拟机网络设置
- iOS第三方开源库的介绍
- 电脑数据类型所占字节(指针类型)
- POJ 1704
- 黑马程序员——Objective-C语言知识点总结之面向对象
- Elasticsearch入门基础----对于刚接触es的人员来说很棒
- 如何设置共享文件夹
- 【爬虫之路】批量下载5sing上一位歌手的全部歌曲
- SSH笔记-注解开发(2)各层次类的编写
- Linux内核ARP的处理函数分析(arp_rcv, arp_send)
- ASIC设计中一种通用型并行设计方法
- 【HDU】5213 Lucky 【分块(在线算法)】