HDOJ 2147 kiki’s game

1610 단어 Integerinputeachidea
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 
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!

제목:
한 m*n의 바둑판에서 (1,m)점에서 출발하여 매번 진행할 수 있는 이동은 왼쪽으로 하나, 아래로 하나, 왼쪽으로 하나이다.그리고 키키가 먼저 갈 때마다 키키를 판단할 때 이긴다.
LANGUAGE:C
CODE;
#include<stdio.h>
int main ()
{
    int n,m;
    while (scanf("%d%d",&n,&m), n||m )
    {
        if(n%2&&m%2)puts("What a pity!");
        else printf("Wonderful!");
    }
    return 0;
}

좋은 웹페이지 즐겨찾기