Georgia and Bob Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 9363   Accepted: 3055 Description Georgia and Bob decide to play a self-invented game. They draw a row of grids on paper, number the grids from left to right by 1, 2, 3, ...…
参考博客 先讲一下Georgia and Bob: 题意: 给你一排球的位置(全部在x轴上操作),你要把他们都移动到0位置,每次至少走一步且不能超过他前面(下标小)的那个球,谁不能操作谁就输了 题解: 当n为偶数的时候,假设当每个球都相互挨着没有间隙,那么两两一组,一组中前面那个走到哪,后面那个跟上就可以了,先手必输 如果球与球之间有间隙,那么俩俩球之间的距离可以当作尼姆博弈中取石子游戏中一堆石子的石子数,用尼姆博弈判断一下就可以了 可以说先手赢不赢光和两球之间的距离有关,如果俩俩球之间的的距离…
Georgia and Bob Time Limit: 1000MS   Memory Limit: 10000KB   64bit IO Format: %I64d & %I64u Submit Status Description Georgia and Bob decide to play a self-invented game. They draw a row of grids on paper, number the grids from left to right by 1, 2,…
Georgia and Bob Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 14312   Accepted: 4840 Description Georgia and Bob decide to play a self-invented game. They draw a row of grids on paper, number the grids from left to right by 1, 2, 3, ..…
Georgia and Bob Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 6622   Accepted: 1932 Description Georgia and Bob decide to play a self-invented game. They draw a row of grids on paper, number the grids from left to right by 1, 2, 3, ...…
n个棋子,其中第k个是红色的,每个棋子只能往上爬,而且不能越过.重叠其他棋子,谁将红色棋子移到顶部谁赢. 由于只能往上爬,所以很像阶梯博弈.这题有2个限制,棋子不能重叠,有红棋存在 首先不考虑红色棋,那么我们可以视棋于棋间的距离为石子堆,这样棋子两两分组就是奇数堆,组与组间的距离就是偶数堆. 有个特殊情况k=2时,此时第一个区间石子数要减小1,不能移完,否则后手直接就能取胜了. /** @Date : 2017-10-13 23:13:24 * @FileName: HDU 4315 阶梯博弈变…
n堆石子,每次选取两堆a!=b,(a+b)%2=1 && a!=b && 3|a+b,不能操作者输 选石子堆为奇数的等价于选取步数为奇数的,观察发现 1 3 4 是无法再移动的 步数为0,然后发现以6为周期,取模就好了 /** @Date : 2017-10-14 19:18:00 * @FileName: HDU 3389 基础阶梯博弈变形.cpp * @Platform: Windows * @Author : Lweleth (SoungEarlf@gmail.com…
Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 11357   Accepted: 3749 Description Georgia and Bob decide to play a self-invented game. They draw a row of grids on paper, number the grids from left to right by 1, 2, 3, ..., and place N c…
题意: 每次可以向左移动一个棋子任意步,不能跨过棋子 很巧妙的转化,把棋子间的空隙看成石子堆 然后裸阶梯Nim #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> using namespace std; typedef long long ll; ; inline int read(){ ,f=; ;c=ge…
题目链接: http://poj.org/problem?id=1704 题意: 给定棋子及其在格子上的坐标,两个人轮流选择一个棋子向左移动,每次至少移动一格,但是不可以碰到其他棋子.无路可走的时候视为输.问最后谁赢. 分析: 将棋牌上的棋子两两看成一组,将他们之间的空格看成棋子,这样就可以转化为Nim游戏 右边的棋子向左走相当于从堆中拿走石子,左边的棋子向左走,增加了棋子的数量,但是只要对手将所加的部分减回去又回到了原来的状态,同样可以转化为Nim问题. 代码: #include<iostre…