*HDU2147 博弈
kiki's game
Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 40000/10000 K (Java/Others)
Total Submission(s): 10208 Accepted Submission(s): 6161
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 coin into the left, the
underneath or the left-underneath blank space.The person who can't make a
move will lose the game. kiki plays it with ZZ.The game always starts
with kiki. If both play perfectly, who will win the game?
contains multiple test cases. Each line contains two integer n, m
(0<n,m<=2000). The input is terminated when n=0 and m=0.
5 4
6 6
0 0
Wonderful!
Wonderful!
P点:就是P个石子的时候,对方拿可以赢(自己输的)
N点:就是N个石子的时候,自己拿可以赢
现在关于P,N的求解有三个规则
(1):最终态都是P
(2):按照游戏规则,到达当前态的前态都是N的话,当前态是P
(3):按照游戏规则,到达当前态的前态至少有一个P的话,当前态是N
题意:
在一个m*n的棋盘内,从(1,m)点出发,每次可以进行的移动是:左移一,下移一,左下移一。然后kiki每次先走,判断kiki时候会赢(对方无路可走的时候)。
我们可以把PN状态的点描绘出来:: 可见都是奇数时是必败点。

*HDU2147 博弈的更多相关文章
- 19-格子游戏(hdu2147博弈)
http://acm.hdu.edu.cn/showproblem.php?pid=2147 kiki's game Time Limit: 5000/1000 MS (Java/Others) ...
- hdu2147 kiki's game(博弈)
这个是纳什博弈?不知道怎么看的 依据PN图,从左下角開始推 左下角P 最后一行都是PNPNPN 第一列都是 P N P N P 完了填完即可了 #include<cstdio> int m ...
- HDU2147 - kiki's game 【巴什博弈】
Recently kiki has nothing to do. While she is bored, an idea appears in his mind, she just playes th ...
- ACM_小游戏(棋盘博弈)
Problem Description: 最近kiki无事可做,于是他想玩棋盘游戏.棋盘的大小是n * m.首先,棋子放置在右上角(1,m). 每次可以将棋子向左方,下方或左下方移动一个位置.当移动到 ...
- hdu----(1849)Rabbit and Grass(简单的尼姆博弈)
Rabbit and Grass Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- HDU 5754 Life Winner Bo 组合博弈
Life Winner Bo Problem Description Bo is a "Life Winner".He likes playing chessboard gam ...
- HDU 2509 Nim博弈变形
1.HDU 2509 2.题意:n堆苹果,两个人轮流,每次从一堆中取连续的多个,至少取一个,最后取光者败. 3.总结:Nim博弈的变形,还是不知道怎么分析,,,,看了大牛的博客. 传送门 首先给出结 ...
- HDU 1907 Nim博弈变形
1.HDU 1907 2.题意:n堆糖,两人轮流,每次从任意一堆中至少取一个,最后取光者输. 3.总结:有点变形的Nim,还是不太明白,盗用一下学长的分析吧 传送门 分析:经典的Nim博弈的一点变形. ...
- 51nod1072(wythoff 博弈)
题目链接: http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1072 题意: 中文题诶~ 思路: 博弈套路是有的, 找np局 ...
随机推荐
- 创建Odoo8数据库时的“new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)“问题
Odoo8创建数据库时,显示如下错误信息: DataError: new encoding (UTF8) is incompatible with the encoding of the templa ...
- Java数据类型和MySql数据类型对应表
- libc++abi.dylib`__cxa_throw: 视频播放时异常
这两天研究视频播放,集成RTMP视频出现的异常,刚好看到一篇博客,楼主使用[AVAudioPlayer Play]时出现了异常...记录下来: 由于xcode中设置了当所有异常出现时的断点,,解决办法 ...
- C语言、结构体 定义
C语言允许用户自己建立由 不同类型数据组成的组合型数据结构 成为结构体. struct Student { int num; //学号 ]; //姓名为字符串 char sex; //性别为字符型 i ...
- mysql事务
1. 事务并不专属于mysql 2. 事务的ACID特性 1)原子性(atomicity) 一个事务必须被视为一个不可分割的最小工作单元,整个事务中得所有操作要么全部提交成功,要么全部失败回滚,对于一 ...
- PHP项目实现手机端和PC端的页面切换
目前访问页面的要切换成手机端和PC端,原理是通过对设备作出判断,显示不同的功能和页面. 如果手机端和PC端的功能结构不相同,一般会写两套系统,一套适用于PC端,一套适用于手机端. 如果功能相同,则只需 ...
- OSError: libcudart.so.7.5: cannot open shared object file: No such file or directory
在ubuntu14.04-64-bit,安装完cuda ,cudnn.opencv后, 配置完MXNet,运行demo 时出现错误,库路径环境变量问题,解决方法: sudo ldconfig /usr ...
- 设置SQL server服务器的dbo架构
服务器登录名,指有权限登录到某服务器的用户: 服务器角色,指一组固定的服务器用户,默认有9组: 登录名一定属于某些角色,默认为public 服务器角色不容许更改 登录后也不一定有权限操作数据库 数据库 ...
- RHEL6.5安装11.2.0.3 RAC并打补丁
[TOC] 一,主机配置 1.修改hosts文件(两节点) #127.0.0.1 localhost localhost.localdomain localhost4 localhost4.local ...
- 安装Python环境时遇到的问题
问题描述:An error occurred during the installation of assembly 'Microsoft.VC90.MFC,version="9.0.210 ...