1. 程式人生 > >HDU 1517: kiki's game

HDU 1517: kiki's game

hat author have pro mil exti -1 until .cn


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