kiki's game

Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 40000/10000 K (Java/Others)
Total Submission(s): 8041    Accepted Submission(s):
4781

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!
查找必胜点和必败点
1、只能通向必胜点的是必败点
#include<stdio.h>
#include<string.h>
int main()
{
int n,m,j,i;
while(scanf("%d%d",&n,&m)&&n!=0&&m!=0)
{
if(n*m&1)
printf("What a pity!\n");
else
printf("Wonderful!\n");
}
return 0;
}

  

hdoj 2147 kiki's game【博弈】的更多相关文章

  1. HDU 2147 kiki's game(博弈经典题)

    题目传送:http://acm.hdu.edu.cn/showproblem.php?pid=2147 Problem Description Recently kiki has nothing to ...

  2. HDU 2147 kiki's game(博弈)

    kiki's game Time Limit: 1000MS   Memory Limit: 10000KB   64bit IO Format: %I64d & %I64u Submit S ...

  3. HDU 2147 kiki's game(博弈图上找规律)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2147 题目大意:给你一个n*m的棋盘,初始位置为(1,m),两人轮流操作,每次只能向下,左,左下这三个 ...

  4. hdu 2147 kiki&#39;s game, 入门基础博弈

    博弈的一些概念: 必败点(P点) : 前一个选手(Previous player)将取胜的位置称为必败点. 必胜点(N点) : 下一个选手(Next player)将取胜的位置称为必胜点. 必败(必胜 ...

  5. HDU.2147 kiki's game (博弈论 PN分析)

    HDU.2147 kiki's game (博弈论 PN分析) 题意分析 简单的PN分析 博弈论快速入门 代码总览 #include <bits/stdc++.h> using names ...

  6. HDU 2147 kiki's game(规律,博弈)

    kiki's game Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 40000/10000 K (Java/Others)Total ...

  7. hdu 2147 kiki's game(巴什博弈)

    kiki's game HDU - 2147 题意:一个n*m的表格,起始位置为右上角,目标位置为左下角,甲先开始走,走的规则是可以向左,向下或者向左下(对顶的)走一格.谁先走到目标位置谁就胜利.在甲 ...

  8. HDU 2147 kiki's game (简单博弈,找规律)

    kiki's game Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 40000/1000 K (Java/Others)Total ...

  9. HDU - 2147 kiki's game 巴什博弈

    思路:以终点(n, m)作为P态,倒推各个坐标的状态,最终得到结论:行数或列数是偶数就能赢,否则输.        AC代码 #include <cstdio> #include < ...

随机推荐

  1. JavaScript的问题

    定义一个函数function, function testParams() { var params = ""; for(var i=0; i<arguments.lengt ...

  2. Delphi 我常用的几个下载源码的站点

    盒子.Delphi园地就不说了,介绍几个其它的: 源码爱好者,特别喜欢. http://www.codefans.net/sort/list_10_1.shtml 新兴源码: http://www.n ...

  3. hdu-A+B问题,大数加法

    格式问题很头疼啊 Input The first line of the input contains an integer T(1<=T<=20) which means the num ...

  4. PHP获得文件的md5并检验是否被修改

    由于需要判断上传的文件是否被修改过,需要记录上传文件的md5值,所以这里说一下一下获取文件md5值的方法.   md5_file() md5_file() 函数计算文件的 MD5 散列.md5() 函 ...

  5. C# RichTextBox 获取当前显示部分的文字

    int start = richTextBox1.GetCharIndexFromPosition(new Point(0, 0)); int end = richTextBox1.GetCharIn ...

  6. [原博客] POJ 1067 取石子游戏

    题目链接有两堆石子,数量任意,可以不同.游戏开始由两个人轮流取石子.游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子:二是可以在两堆中同时取走相同数量的石子.最后把石子全部取完者 ...

  7. http://rogerdudler.github.io/git-guide/index.zh.html

    http://rogerdudler.github.io/git-guide/index.zh.html

  8. 李洪强漫谈iOS开发[C语言-030]-逻辑运算符

  9. [转贴]一个将表格变成 INSERT 的SQL 语句的存储过程(sql server)

    来源自http://vyaskn.tripod.com/code.htm#inserts SET NOCOUNT ON GO PRINT 'Using Master database' USE mas ...

  10. 【Xamarin挖墙脚系列:Xamarin.Android的API设计准则】

    原文:[Xamarin挖墙脚系列:Xamarin.Android的API设计准则] 前言 楼主也是看着Xamarin的官方文档来的.基本也是照猫画虎.英语勉强凑合.翻译的不对的地方,大家多多指教.(这 ...