HDU 2147 kiki's game(规律,博弈)
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 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!
Author
月野兔
Source
HDU 2007-11 Programming Contest
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2147
分析:推几组数据就可以猜出结论,(a*b)%2==0?"Wonderful!":"What a pity!"
下面给出AC代码:
1 #include <bits/stdc++.h>
2 using namespace std;
3 int main()
4 {
5 int a,b;
6 while(scanf("%d%d",&a,&b)&&(a&&b))
7 {
8 if(a*b%2==0)
9 printf("Wonderful!n");
10 else printf("What a pity!n");
11 }
12 return 0;
13 }
- mysql left( right ) join使用on 与where 筛选的差异
- 一条长sql的排错过程
- (41) 剖析HashSet / 计算机程序的思维逻辑
- Python时间运算的详细机制初探讨
- C++编译错误cannot have cv-qualifier
- Python写TCP端口扫描工具之IP协议的讲解
- mac上nginx+jetty负载均衡部署一览
- Python标准库(1) — itertools模块
- C++从键盘输入文件结束符
- java cpu高达100%问题 排查
- (43) 剖析TreeMap / 计算机程序的思维逻辑
- Spring Cloud第一篇 Eureka简介及原理
- 华为面试题——约瑟夫问题的C++简单实现(循环链表)
- (49) 剖析LinkedHashMap / 计算机程序的思维逻辑
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- Stata估算观测数据的风险比
- R语言利用基线协变量提高随机对照试验的效率
- R语言使用倾向评分提高RCT(随机对照试验)的效率
- R语言调整随机对照试验中的基线协变量
- R语言用多重插补法估算相对风险
- R语言分析协变量之间的非线性关系
- stata如何处理结构方程模型(SEM)中具有缺失值的协变量
- stata对包含协变量的模型进行缺失值多重插补分析
- 互联网直播点播平台go语言搭建重定向和反向代理的区别及使用
- UNIX时间戳和北京时间的相互转换
- R语言对苏格兰独立民意调查的Meta分析
- 案例:归档自动清理脚本失效及连带影响
- R语言中固定与随机效应Meta分析 - 效率和置信区间覆盖
- R语言使用 LOWESS技术图分析逻辑回归中的函数形式
- R语言在逻辑回归中求R square R方