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…
传送门 题意: 和上题基本一样:山顶可以有多人,谁先把king放到山顶谁就胜 并不太明白 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> using namespace std; typedef long long ll; ; inline int read(){ ,f=; ;c=getchar();} +…
参考博客 先讲一下Georgia and Bob: 题意: 给你一排球的位置(全部在x轴上操作),你要把他们都移动到0位置,每次至少走一步且不能超过他前面(下标小)的那个球,谁不能操作谁就输了 题解: 当n为偶数的时候,假设当每个球都相互挨着没有间隙,那么两两一组,一组中前面那个走到哪,后面那个跟上就可以了,先手必输 如果球与球之间有间隙,那么俩俩球之间的距离可以当作尼姆博弈中取石子游戏中一堆石子的石子数,用尼姆博弈判断一下就可以了 可以说先手赢不赢光和两球之间的距离有关,如果俩俩球之间的的距离…
博弈论入门: 巴什博弈: 两个顶尖聪明的人在玩游戏,有一堆$n$个石子,每次每个人能取$[1,m]$个石子,不能拿的人输,请问先手与后手谁必败? 我们分类讨论一下这个问题: 当$n\le m$时,这时先手的人可以一次取走所有的: 当$n=m+1$时,这时先手无论取走多少个,后手的人都能取走剩下所有的: 当$n=k*(m+1)$时,对于每$m+1$个石子,先手取$i$个,后手一定能将剩下的$(m+1-i)$个都取走,因此后手必胜: 当$n=k*(m+1)+x(0<x<m+1)$时,先手可以先取$…
Climbing the Hill Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 919    Accepted Submission(s): 411 Problem Description Alice and Bob are playing a game called "Climbing the Hill". The ga…
http://acm.hdu.edu.cn/showproblem.php?pid=4315 题意:由上至下有多个格子,最顶端的是山顶,有多个球,其中有一个球是king,每次可以将球向上移动任意个格子,但是不可以跨越别的球.现将king移动到山顶者赢. 思路:和poj1704是差不多的,如果不懂阶梯博弈的话,可以看看我的这篇博客http://www.cnblogs.com/zyb993963526/p/7868315.html. 现在还是两两分组,谁没空格可移肯定是必败状态,为什么呢?首先,如果…
题意:有n个人爬山,山顶坐标为0,其他人按升序给出,不同的坐标只能容纳一个人(山顶不限),Alice和Bob轮流选择一个人让他移动任意步,但不能越过前面的人,且不能和前面一个人在相同的位置.现在有一个人是king,给出king是哪个人(id),谁能将国王移动到山顶谁胜. 解题思路:先考虑简化版,没有king,谁先不能移动谁输掉.和阶梯博弈类似http://blog.csdn.net/longshuai0821/article/details/7793043.根据人数的奇偶性:把人从上顶向下的位置…
http://acm.hdu.edu.cn/showproblem.php? pid=1849 简单的尼姆博弈: 代码例如以下: #include <iostream> #include <cstdio> using namespace std; int main() { int m,n,t; while(cin>>m,m) { int ans=0; for(int i=0; i<m; i++) { cin>>n; ans^=n; } if(ans==…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1907 Problem Description Little John is playing very funny game with his younger brother. There is one big box filled with M&Ms of different colors. At first John has to eat several M&Ms of the same c…
HDU.1850 Being a Good Boy in Spring Festival (博弈论 尼姆博弈) 题意分析 简单的nim 博弈 博弈论快速入门 代码总览 #include <bits/stdc++.h> #define nmax 105 using namespace std; int a[nmax]; int main() { int m; while(scanf("%d",&m) != EOF && m){ int ans = 0,…