hdu 2147 kiki's game (巴什博奕)
题意:一个n*m的方格,有一个棋子初始在右上角(1,m),每次可以将棋子向下或者向左或者向左下移动**一个格子,**不能移出边界,当无路可走的时候就输了,问谁存在必赢策略。
思路:画n点p点。。。左下肯定是p 然后最后发现 n%2==1&&m%2==1的时候必输,否则必赢。
然后因为把m%2谢成名m&2 WA了好多发呵呵呵呵呵呵。
1/* ***********************************************
2Author :111qqz
3Created Time :2016年07月19日 星期二 20时09分37秒
4File Name :code/hdu/2147.cpp
5************************************************ */
6
7#include <cstdio>
8#include <cstring>
9#include <iostream>
10#include <algorithm>
11#include <vector>
12#include <queue>
13#include <set>
14#include <map>
15#include <string>
16#include <cmath>
17#include <cstdlib>
18#include <ctime>
19#define fst first
20#define sec second
21#define lson l,m,rt<<1
22#define rson m+1,r,rt<<1|1
23#define ms(a,x) memset(a,x,sizeof(a))
24typedef long long LL;
25#define pi pair < int ,int >
26#define MP make_pair
27
28using namespace std;
29const double eps = 1E-8;
30const int dx4[4]={1,0,0,-1};
31const int dy4[4]={0,-1,1,0};
32const int inf = 0x3f3f3f3f;
33int n,m;
34int main()
35{
36 #ifndef ONLINE_JUDGE
37 freopen("code/in.txt","r",stdin);
38 #endif
39
40 while (scanf("%d%d",&n,&m)!=EOF)
41 {
42 if (n==0&&m==0) break;
43 if (n%2==1&&m&2==1)
44 {
45 puts("What a pity!");
46 }
47 else
48 {
49 puts("Wonderful!");
50 }
51 }
52
53 #ifndef ONLINE_JUDGE
54 fclose(stdin);
55 #endif
56 return 0;
57}