题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=2147
我们可以把PN点描绘出来,P表示输,N表示赢
很显然可知,当n,m都为奇数时就输了,否则就赢了
代码如下:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;
/*
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
*/
int main()
{
int n,m;
while(cin>>n>>m&&(n+m))
{
if(n&1&&m&1)//如果n、m都是奇数则输
printf("What a pity!\n");
else
printf("Wonderful!\n");
}
return 0;
}