![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
组合博弈
orangesczq
落寞是岁月的痕迹
展开
-
组合博弈之SG入门
【HD1846】Brave Game 暴力SG表#include <bits/stdc++.h>using namespace std;const int maxn = 1000;int sg[maxn];bool Hash[maxn];void sg_solve(int n,int m){ memset(sg,0,sizeof(sg)); fo原创 2016-08-06 12:53:06 · 295 阅读 · 0 评论 -
【HDOJ5795】 A Simple Nim(博弈)
A Simple Nimsg[0]=0当x=8k+7时sg[x]=8k+8,当x=8k+8时sg[x]=8k+7,其余时候sg[x]=x;(k>=0)打表找规律可得,数学归纳法可证。#include <cstdio>#include <iostream>#include <cstring>#include <string>#include <algorithm>#i原创 2016-08-06 16:08:27 · 246 阅读 · 0 评论 -
【HDOJ1847】Good Luck in CET-4 Everybody!(博弈)
简单博弈 暴力打表 只能取2的幂次#include <cstdio>#include <iostream>#include <cstring>#include <string>#include <algorithm>#include <cstdlib>#include <vector>#include <set>#include <map>#include原创 2016-08-06 16:02:24 · 283 阅读 · 0 评论 -
【HDOJ1536】S-Nim(博弈)
大致题意: 给你一个a数组 每次可以取a[i]个,q次询问,每次询问 共有m堆,因为sg函数是一堆的,所以将每堆的sg值异或就是答案。#include <bits/stdc++.h>using namespace std;const int maxn = 10000 + 10;int s[110];int sg[maxn];bool Hash[maxn]; /原创 2016-08-06 14:16:31 · 656 阅读 · 0 评论