HDU 1517: kiki's game
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HDU 1517: kiki's game相关的知识,希望对你有一定的参考价值。
/**
* @link http://acm.hdu.edu.cn/showproblem.php?pid=1517
* @author Sycamore
* @date Aug, 21
*/
// Suppose that their exists a direction(vertically or horizontally) in which
// the steps remaining to arrive at the destination (n-1 or m-1) is even, as long
// as Kiki adjusts the position of the chess to the following parity at first, he
// always has the priority of keeping the parity in both directions unchanged (even)
// every time it‘s ZZ‘s turn until the chess reaches the terminal and ZZ is trapped.
// On the opposite occasion, ZZ will have that priority so that Kiki will lost
// the game.
import java.util.*;
class Main{
public static void main(String args[]){
Scanner scanner=new Scanner(System.in);
while(scanner.hasNextInt()){
int n=scanner.nextInt(),m=scanner.nextInt();
if(n==0&&m==0)break;
System.out.println(((n&1)==0||(m&1)==0)?"Wonderful!":"What a pity!");
}
scanner.close();
}
}
以上是关于HDU 1517: kiki's game的主要内容,如果未能解决你的问题,请参考以下文章