hdu 2147 kiki's game (巴什博奕)

hdu 2147 题目链接

题意:一个n*m的方格,有一个棋子初始在右上角(1,m),每次可以将棋子向下或者向左或者向左下移动**一个格子,**不能移出边界,当无路可走的时候就输了,问谁存在必赢策略。

思路:画n点p点。。。左下肯定是p  然后最后发现 n%2==1&&m%2==1的时候必输,否则必赢。

然后因为把m%2谢成名m&2 WA了好多发呵呵呵呵呵呵。

/* ***********************************************
Author :111qqz
Created Time :2016年07月19日 星期二 20时09分37秒
File Name :code/hdu/2147.cpp
************************************************ */
 1#include <cstdio>
 2#include <cstring>
 3#include <iostream>
 4#include <algorithm>
 5#include <vector>
 6#include <queue>
 7#include <set>
 8#include <map>
 9#include <string>
10#include <cmath>
11#include <cstdlib>
12#include <ctime>
13#define fst first
14#define sec second
15#define lson l,m,rt<<1
16#define rson m+1,r,rt<<1|1
17#define ms(a,x) memset(a,x,sizeof(a))
18typedef long long LL;
19#define pi pair < int ,int >
20#define MP make_pair
 1using namespace std;
 2const double eps = 1E-8;
 3const int dx4[4]={1,0,0,-1};
 4const int dy4[4]={0,-1,1,0};
 5const int inf = 0x3f3f3f3f;
 6int n,m;
 7int main()
 8{
 9	#ifndef  ONLINE_JUDGE 
10	freopen("code/in.txt","r",stdin);
11  #endif
 1	while (scanf("%d%d",&n,&m)!=EOF)
 2	{
 3	    if (n==0&&m==0) break;
 4	    if (n%2==1&&m&2==1)
 5	    {
 6		puts("What a pity!");
 7	    }
 8	    else
 9	    {
10		puts("Wonderful!");
11	    }
12	}
1  #ifndef ONLINE_JUDGE  
2  fclose(stdin);
3  #endif
4    return 0;
5}