hdu 2147 博弈递推

来源:互联网 发布:java怎么解析cad图纸 编辑:程序博客网 时间:2024/05/23 15:52

简单dp或者观察一下即可找出规律,都是奇数为P态。

#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#include <cmath>using namespace std;#define pr(x) cout << #x << ": " << x << "  " #define pl(x) cout << #x << ": " << x << endl;struct jibancanyang{    int n, m;    void fun() {        while (cin >> n >> m, n || m) {            if (n % 2 && m % 2) puts("What a pity!");            else puts("Wonderful!");        }    }}ac;int main(){#ifdef LOCAL    freopen("in.txt", "r", stdin);    //freopen("out.txt", "w", stdout);#endif    ac.fun();    return 0;}
0 0