Hdu 2147 kiki's game

Source: Internet
Author: User

Click Open link

Kiki's game Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 40000/1000 K (Java/Others)
Total Submission (s): 6933 Accepted Submission (s): 4141


Problem DescriptionRecently 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 pla Ys it with ZZ. The game always starts with kiki. If both play perfectly, who will win the game?
 
InputInput 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.

 
OutputIf kiki wins the game printf "Wonderful! ", Else" What a pity! ".
 
Sample Input
5 35 46 60 0
 
Sample Output
What a pity! Wonderful! Wonderful!
 
Author yures
SourceHDU 2007-11 Programming Contest
The square of n * m is given to start from (n, m) to the left or bottom of the left.

Win () and ask who can win

# Include <cstdio> # include <cstring> int main () {int n, m; while (scanf ("% d", & n, & m )! = EOF & (n | m) {if (n % 2 & m % 2) printf ("What a pity! \ N "); else printf (" Wonderful! \ N ") ;}return 0 ;}


Hdu 2147 kiki's game

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.