hdu杭电 2147 kiki's game
2015-07-25 23:07
302 查看
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
Sample Output
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!
#include<stdio.h> int main() { int m,n; while(scanf("%d%d",&m,&n),m+n) { if(m%2==0||n%2==0) printf("Wonderful!\n"); else printf("What a pity!\n"); } return 0; } /* 我们把Win的地方标记成W,Lose的地方标记成L W W W W W W W W L W L W L W L W W W W W W W W W L W L W L W L W W W W W W W W W L W L W L W L W 我们可以找到规律,当m%2==0||n%2==0,就Win了 */
相关文章推荐
- DHCP:动态主机配置协议
- Android中popupWindow的简单应用
- centos最小化安装后再安装图形界面
- Codeforces Round #312 (Div. 2)小结
- 消除 activity 启动时白屏、黑屏问题
- Centos7安装gitlab
- 基于MFC的socket编程(异步非阻塞通信)
- [C++学习笔记]--位运算、引用、const指针
- CNN卷积神经网络学习笔记4:代码学习
- (详细图解)把SQLServer数据导入Access中
- 最简单的基于FFmpeg的移动端例子附件:SDL Android HelloWorld
- asp.net重写服务器控件
- iOS 多线程GCD 四
- C语言判断用户输入的是字符还是数字
- centos6.5下postgresql9.4.3同步流复制的standby安装与配置
- 编译hadoop-2.5.2的源码过程
- centos6.5下postgresql9.4.3同步流复制的standby安装与配置
- zoj2417 Lowest Bit
- csu 1604 SunnyPig (bfs)
- java IO图