hdoj 2147 kiki's game 【博弈】
2015-07-25 12:42
537 查看
kiki's game
Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 40000/10000 K (Java/Others)Total Submission(s): 8005 Accepted Submission(s): 4751
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 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
5 3 5 4 6 6 0 0
Sample Output
What a pity! Wonderful! Wonderful!
一开始怎么想都感觉不对劲,最后发现自己漏看个条件,可以走左下方!!!
AC代码:判断必胜点
#include <cstdio> #include <cstring> int main() { int n, m; while(scanf("%d%d", &n, &m), n || m) { if(n & 1 && m & 1) printf("What a pity!\n"); else printf("Wonderful!\n"); } return 0; }
相关文章推荐
- 数组复制
- 使用Java7提供Fork/Join框架
- redis学习资料
- Java内部类的使用小结
- PCB 设计技巧一百问
- 自己写的一个servlet Dispatchar,便于在osgi使用(一)
- Leetcode Next Permutation
- hdu 4126
- ------------------------------------------------------------
- 一个漂亮的PHP验证码
- Python实现简单的代理服务器
- 微软官方Win10系统U盘谍照曝光 含32位/64位双重版本
- 己亥岁
- HTML之标签
- 深入了解View(三)—— draw绘制流程分析
- 使用abel533大神的mybatis分页插件总结
- 一个漂亮的php验证码类(分享)
- android图片处理之图像模糊
- Codeforces Beta Round #93 (Div. 1 Only) D. Fibonacci Sums
- unity灯光Lightmapping、LightProbes