博弈
ZJLORD
这个作者很懒,什么都没留下…
展开
-
Hdu1404 Digital Deletions
题意: 给定一串序列,每次可以删除0右边的数或者把最右边的数改为比他小的数。开始不会,搜的题解,完全没想到SG函数,哎!由于题目给定的序列不长,最多就是只有1e6,可以直接暴力打个1~1e6的SG函数值。然后最后只需要根据当前的SGh函数值判断就行。关于这个怎么打SG 函数的表我其实也不太会,反正别人的代码写的挺好,我肯定想不到了。#include#includeu原创 2017-08-10 19:37:14 · 274 阅读 · 0 评论 -
Crosses and Crosses POJ 3537
Crosses and Crosses POJ 3537 SG一个普通的打表SG 函数题目。算是结尾博弈这一章的学习吧! 博弈前后做了两个星期了吧,刷了两套题,但是还是有好多不懂,对于 NIM积,还有一些高阶 的删边 问题,甚至 SG 打表找规律 也会有时候做不出来,下次博弈的训练还有好多要学~~~~~~题意: 给你一行格子,每次两个人依原创 2017-08-18 14:18:01 · 266 阅读 · 0 评论 -
GG and MM
Every_SG博弈原创 2017-08-10 21:09:13 · 316 阅读 · 1 评论 -
Nim or not Nim? HDU 3032
SG函数+1;由于题目给的数据很大,直接写SG 肯定会超时,这时候就只能打表找规律了。打出SG函数的表,然后找出规律。实在看不出就往下滑吧。打表SG:#include#includeint sg[1007],vis[1007];int main(){ sg[0]=0;sg[1]=1; int j; for(int i=2;i<=1原创 2017-08-10 20:52:05 · 207 阅读 · 0 评论 -
Bomb Game
SG函数,第一个二维平面算SG函数的题: 对于在边界上的点之后向一边扩展,而对于中间的无边界的点就会向两边扩张,即SG[a][j]^SG[i][b] ;#include#includeusing namespace std;const int maxn =52;int hash[10010];int map[maxn][maxn];int Get_原创 2017-08-10 20:49:16 · 942 阅读 · 0 评论 -
hdu---(1848)Fibonacci again and again
分析发现就是一个SG 函数的变形, 具体来说就是打个Fibonacci 函数的表,然后再打个SG 函数的表就完美的解决了。#include#include#include#include#include#define N 5050int f[N],sg[N],hash[N];void getSG(int n){ int i,j; memset(sg,原创 2017-08-10 20:35:36 · 179 阅读 · 0 评论 -
Northcott Game
Northcott Game Nim Game : 直接类比取石子就行。每行类比为每堆石子,中间的空格类比为石子 的数量。然后就是Nim Game 了。#include#include#include#includeint abs(int x){ if(x<0) return -原创 2017-08-10 20:27:36 · 525 阅读 · 0 评论 -
hdu 1729 Stone Game
HDU Stone Game大概是一道水题吧,了解SG函数的性质就行。不过还是看了别人的代码。具体分析 点击打开找到必胜的条件吧,然后可以递归来求解不确定状态吧。#include#include#include#includeusing namespace std;int SG(int s,int t){ int c=sqrt(s原创 2017-08-10 20:09:54 · 228 阅读 · 0 评论 -
POJ 2960 S-Nim (sg函数)
S_NimArthur and his sister Caroll have been playing a game called Nim for some time now. Nim is played as follows: The starting position has a number of heaps, all containing some, not原创 2017-08-10 19:57:40 · 182 阅读 · 0 评论 -
1024 Calendar Game
1024 Calendar Game原创 2017-08-10 19:54:22 · 674 阅读 · 2 评论