hdu1564 Play a game【博弈 找规律】

    xiaoxiao2025-11-17  1

    传送门:hdu1564

    又是蛋疼的找规律,只会打表。。。胜负和奇偶性有关 证明参考: HDU 1564 Play a game (找规律博弈) - kuangbin - 博客园 这篇感觉好懂点 hdu 1564 证明 - coder notebook - 博客频道 - .NET 还没看懂。。

    #include <cstdio> int main() { int n; while(scanf("%d", &n), n) puts(n&1?"ailyanlu":"8600"); return 0; } //打表代码 const int MAXN = 10010; bool visit[MAXN][MAXN]; int nx[4] = {0, 1, 0, -1}, ny[4] = {1, 0, -1, 0}; int n; bool dfs(int x, int y) { for(int i = 0; i < 4; i++) { int tx = x + nx[i]; int ty = y + ny[i]; if(tx < 1 || tx > n || ty < 1 || ty > n) continue; if(!visit[tx][ty]) { visit[tx][ty] = true; bool flag = dfs(tx, ty); visit[tx][ty] = false; if(!flag) return true; } } return false; }
    转载请注明原文地址: https://ju.6miu.com/read-1304286.html
    最新回复(0)