码迷,mamicode.com
首页 > 其他好文 > 详细

HDU 1517: kiki's game

时间:2017-08-21 21:57:26      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:href   ping   ble   ack   family   ever   new   sts   span   


/**
* @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

标签:href   ping   ble   ack   family   ever   new   sts   span   

原文地址:http://www.cnblogs.com/zjnu/p/7406844.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!