博弈的一些概念: 必败点(P点) : 前一个选手(Previous player)将取胜的位置称为必败点. 必胜点(N点) : 下一个选手(Next player)将取胜的位置称为必胜点. 必败(必胜)点属性 (1) 全部终结点是必败点(P点): (2) 从不论什么必胜点(N点)操作,至少有一种方法能够进入必败点(P点): (3)不管怎样操作, 从必败点(P点)都仅仅能进入必胜点(N点). pid=2147">hdu 2147 kiki's game 题意: 在一个m*n的棋盘内,从(1,…
kiki's game HDU - 2147 题意:一个n*m的表格,起始位置为右上角,目标位置为左下角,甲先开始走,走的规则是可以向左,向下或者向左下(对顶的)走一格.谁先走到目标位置谁就胜利.在甲乙都采用最佳策略的时候,先走者能否获胜. 这是一个5*5的PN图 从中可以看出,只要满足行或列中的某一个为偶数就可以先手必胜 #include<iostream> #include<cstdio> using namespace std; int main(){ int n,m; ){…
HDU.2147 kiki's game (博弈论 PN分析) 题意分析 简单的PN分析 博弈论快速入门 代码总览 #include <bits/stdc++.h> using namespace std; int main() { int n,m; while(scanf("%d %d",&n,&m) != EOF){ if(n == 0 && m == 0) break; if(n%2 && m%2){ printf(&q…
题目传送:http://acm.hdu.edu.cn/showproblem.php?pid=2147 Problem Description 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 i…
kiki's game Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 40000/10000 K (Java/Others)Total Submission(s): 10763    Accepted Submission(s): 6526 Problem Description Recently kiki has nothing to do. While she is bored, an idea appears in his…
kiki's game Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 40000/1000 K (Java/Others)Total Submission(s): 5094    Accepted Submission(s): 2985 Problem Description Recently kiki has nothing to do. While she is bored, an idea appears in his mi…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2147 题目大意:给你一个n*m的棋盘,初始位置为(1,m),两人轮流操作,每次只能向下,左,左下这三个方向移动,谁最后无法移动棋子就输掉比赛,问先手是否会获胜. 解题思路:简单题,P/N分析找规律,以(n,m)点为结束点推到起始点,如图: 发现每个田字格的状态都是一样的,因为(n,m)点一定时P态,所以可以得出规律:只有当(m%2==1&&n%2==1)时,先手才会输. 代码: #includ…
kiki's game Time Limit: 1000MS   Memory Limit: 10000KB   64bit IO Format: %I64d & %I64u Submit Status Description 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…
kiki's game Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 40000/10000 K (Java/Others)Total Submission(s): 10656    Accepted Submission(s): 6455 Problem Description Recently kiki has nothing to do. While she is bored, an idea appears in his…
HDU 1564 Play a game题意: 棋盘的大小是n*n.一块石头被放在一个角落的广场上.他们交替进行,8600人先走.每次,玩家可以将石头水平或垂直移动到一个未访问的邻居广场.谁不采取行动,谁就会输掉这场比赛.如果双方都打得很好,谁将赢得比赛? 题解: 三角形代表起始位置,虽然不是右上角但是解题都差不多 如果n为偶数,那么所有格子可以被2*1的砖块覆盖掉. 这样先手每次都移动到当前1*2的另外一块.先手必赢. 如果n为奇数.出了起始那个店,其余点都可以被覆盖. 代码: 1 #incl…