Crazy Calendar (阶梯博弈变形)】的更多相关文章

2011 was a crazy year. Many people all over the world proposed on 11-11-11, married on 11-11-11, some even went through surgery only to have 11-11-11 as their child's birth date. How crazy people can be! Don't they see there is a "20" hidden? Th…
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…
题意:r*c方格中,每个格子有一定石子,每次移动每格任意数量石子,只能向下或者向右动一格,不能移动为败 思路:显然是Nim,到右下曼哈顿距离为偶数的不用管,因为先手动一下后手动一下最后移到右下后还是先手的回合:奇数移动一格必到偶数格,所以奇数的Nim一下.很简单的入门题. 代码: #include<set> #include<map> #include<stack> #include<cmath> #include<queue> #include…
C - Crazy Calendar Time Limit:4000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1393 Description 2011 was a crazy year. Many people all over the world proposed on 11-11-11, married on 11-11-11, some even w…
阶梯博弈原理参考:http://www.cnblogs.com/jiangjing/p/3849284.html 这题计算每两个之间的间隔就行了,如果是奇数个就把第一个前面的看作一个,偶数个就是两个点之间的间隔 m==1的时候特判,因为能一步就胜,m==2的情况第一个间隔要加1,因为当第一个间隔为0的时候,此时就是必胜态 #include<map> #include<set> #include<cmath> #include<queue> #include&…
Climbing the Hill Time Limit: 1000MS   Memory Limit: 32768KB   64bit IO Format: %I64d & %I64u Submit Status Description Alice and Bob are playing a game called "Climbing the Hill". The game board consists of cells arranged vertically, as the…
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,…
http://acm.hdu.edu.cn/showproblem.php?pid=4315 题意:有n个人要往坐标为0的地方移动,他们分别有一个位置a[i],其中最靠近0的第k个人是king,移动的时候在后面的人不能越过前面的人,先把king送到0的人胜. 思路:阶梯博弈.把n个人两两配对,形成一个组,即a[i]和a[i+1]是一个组,a[i+2]和a[i+3]是一个组,把a[i]和a[i+1]的距离当成阶梯博弈中的奇数阶的值,a[i+1]和a[i+2]的距离当成偶数阶(不用考虑).首先k=1…
#include<stdio.h> int main() { int t,n,ans; int i,j,x; scanf("%d",&t); ;j<=t;j++) { scanf("%d",&n); ans=; ;i<=n;i++) { scanf("%d",&x); ==||i%==||i%==) { ans^=x; } } printf("Case %d: ",j); if(…