kiki's game HDU - 2147

原题链接

思路:

        直接dfs会MLE,需要打表,根据行列奇偶性判断是否能胜,由打表得当n%2==1&&m%2==1时必败.

 1 #include <iostream>
 2 #include <cstring>
 3 using namespace std;
 4 int n,m;
 5 int main()
 6 {
 7     while(scanf("%d%d",&n,&m)!=EOF&&(n+m))
 8     {
 9         if(n%2==0) puts("Wonderful!");
10         else if(m%2) puts("What a pity!");
11         else puts("Wonderful!");
12     }
13     return 0;
14 }

 

posted @ 2021-03-21 17:11  acmloser  阅读(15)  评论(0编辑  收藏  举报