hdu2147 kiki's game(博弈)】的更多相关文章

这个是纳什博弈?不知道怎么看的 依据PN图,从左下角開始推 左下角P 最后一行都是PNPNPN 第一列都是 P N P N P 完了填完即可了 #include<cstdio> int main() { int n,m; while(scanf("%d%d",&n,&m)&&n&&m){ if(n&1&&m&1) printf("What a pity!\n"); else…
/* HDU2147 kiki's game 博弈论 巴什博奕 http://acm.hdu.edu.cn/showproblem.php?pid=2147 题意:在一个n×m的棋盘上,初始棋子放在右上角, 先走到左下角的胜 打出胜负表: n:必胜态 p:必败态 n n n n n p n p n p n n n n n p n p n p n n n n n p n p n p n n n n n p n p n p * * * */ #include <cstdio> int main()…
博弈的一些概念: 必败点(P点) : 前一个选手(Previous player)将取胜的位置称为必败点. 必胜点(N点) : 下一个选手(Next player)将取胜的位置称为必胜点. 必败(必胜)点属性 (1) 全部终结点是必败点(P点): (2) 从不论什么必胜点(N点)操作,至少有一种方法能够进入必败点(P点): (3)不管怎样操作, 从必败点(P点)都仅仅能进入必胜点(N点). pid=2147">hdu 2147 kiki's game 题意: 在一个m*n的棋盘内,从(1,…
Recently kiki has nothing to do. While she is bored, an idea appears in his mind, she just playes the checkerboard game.The size of the chesserboard is n*m.First of all, a coin is placed in the top right corner(1,m). Each time one people can move the…
kiki's game Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 40000/10000 K (Java/Others)Total Submission(s): 8041    Accepted Submission(s): 4781 Problem Description Recently kiki has nothing to do. While she is bored, an idea appears in his m…
Recently kiki has nothing to do. While she is bored, an idea appears in his mind, she just playes the checkerboard game.The size of the chesserboard is n*m.First of all, a coin is placed in the top right corner(1,m). Each time one people can move the…
Problem Description For the k-th number, we all should be very familiar with it. Of course,to kiki it is also simple. Now Kiki meets a very similar problem, kiki wants to design a container, the container is to support the three operations. Push: Pus…
题意:给定一个 n * m 的格子,从右上角(1, m) 开始每个玩家只能从向下,向左,或者向左下走,谁不能走,谁输. 析:自己做出来,看了网上的几个博客,好像都没说为什么是只有全奇的情况才会输,个人的理解如下,如果不对,欢迎指正. 首先,从(1, m)  走到 (n, 1) 这才是一个完整的,也就是如果论到谁开始移动的时候当时的位置是 (n, 1),那么它就输了,因为只能向下,向左,向左下,而这些方向都出界了.这样看不大好看,我们可以看成是从 (n, m) 走到 (1, 1),同理如果论到谁开…
题目:http://www.spoj.com/problems/ORDERS/ and pid=2852">http://acm.hdu.edu.cn/showproblem.php? pid=2852 题意:spoj227:告诉每一个位置前面有多少个数比当前位置小,求出原序列. hdu2852:设计一个容器,支持几种操作:添加/删除元素,求容器中比a大的数中第k小的数是多少. 分析:两个题思路都是求数组里面的第K小的数.開始一直在找O(N*logN)的方法,后来发现O(N*logN*lo…
题意: 给一个有n*m 个格子的棋盘,将一个硬币放在右上角一格,每次可以往左/下/左下移动一格,碰到不能移动的局面者输. 思路: 找P/N状态.先将(n,1)归为P状态,那么能一步到达此位置的有3个位置,分别是其上/右/右上的格子.根据这个规律来找,在整个棋盘的格子上标上P和N.可以发现,棋盘上是有规律的,若提供的n和m皆为奇数,则先手输:否则先手赢. #include <iostream> #include <cstdio> using namespace std; int ma…