HDU 2147 kiki's game 博弈论
来源:互联网 发布:b2b源码授权费用 编辑:程序博客网 时间:2024/05/16 09:34
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 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?
Input Input 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.
Output If kiki wins the game printf "Wonderful!", else "What a pity!".
Sample Input Sample Output What a pity!
Wonderful!
Wonderful!
传送门 hdu崩着= =
套路似乎差不多……按照“全推N为P,能推P为N”的思路, 这题左下角为P,然后可以扩展推导。 本来可以O(NM)预处理的,但是空间比较小。。 那么就找一找这个推导的规律。
X是必败态,O是必胜态; 那么画一画就可以出来了。 规律非常明显吧……
5 35 46 60 0
Wonderful!
Wonderful!
#include<bits/stdc++.h>using namespace std;int main(){int x,y;while (1){scanf("%d%d",&x,&y);if (!x) break;if (!(x&1)) puts("Wonderful!"); elseif (!(y&1)) puts("Wonderful!"); else puts("What a pity!");}return 0;}
阅读全文
0 0
- HDU 2147kiki's game 博弈论
- HDU 2147 kiki's game(博弈论)
- hdu 2147 kiki's game(博弈论)
- kiki's game - HDU 2147 博弈论
- hdu-2147-kiki's game-博弈论-java
- HDU 2147 kiki's game 博弈论
- HDU 2147 kiki's game(巴什博弈论)
- HDU 2147-kiki's game(NP图解决博弈论)
- HDU.2147 kiki's game (博弈论 PN分析)
- hdu2147 -- kiki's game(博弈论)
- hdu 2147 kiki's game
- HDU-2147:kiki's game
- hdu 2147 kiki's game
- HDU 2147 - kiki's game
- hdu 2147 kiki's game
- HDU 2147 kiki's game
- HDU 2147kiki's game
- hdu 2147 kiki's game
- kotlin实现一个简单的新闻客户端-01
- 重温数据结构:二叉树的常见方法及三种遍历方式 Java 实现
- Java Activiti(1)---基础流程
- Python 之 基础面向对象编程
- 7-1 银行业务队列简单模拟
- HDU 2147 kiki's game 博弈论
- 二维码
- 数论小练
- 进程间通信-信号量2
- HTTP协议优秀博客推荐
- HTML5动画
- 大学生职业规范生涯
- LeetCode57 Insert Interval
- LeetCode No.233 Number of Digit One 题解