poj2068--Nim】的更多相关文章

Let's play a traditional game Nim. You and I are seated across a table and we have a hundred stones on the table (we know the number of stones exactly). We play in turn and at each turn, you or I can remove on to four stones from the heap. You play f…
传送门 题意简述:m个石子,有两个队每队n个人循环取,每个人每次取石子有数量限制,取最后一块的输,问先手能否获胜. 博弈论+dp. 我们令f[i][j]f[i][j]f[i][j]表示当前第i个人取石子,石子还剩下j个时能否获胜. 显然如果有取法让轮到第(i+1)(i+1)(i+1) modmodmod 2n2n2n 个人有必败状态,那么的当前就是必胜状态. 再令k=(i+1)k=(i+1)k=(i+1) modmodmod 2n2n2n 于是f[i][j]=f[k][j−1]∣f[k][j−2…
http://poj.org/problem?id=2068 博弈论的动态规划,依然是根据必胜点和必输点的定义,才明白过来博弈论的dp和sg函数差不多完全是两个概念(前者包含后者),sg函数只是mex操作处理多个博弈游戏的一种方法,mdzz要改以前的标签了. f [ i ] [ j ] [ k ] 表示: i队伍在第j个队员取前还剩下k个石头的状态为i队伍必胜还是必输. 代码 #include<cstdio> #include<cstring> #include<algori…
SG函数: 给定一个有向无环图和一个起始顶点上的一枚棋子,两名选手交替的将这枚棋子沿有向边进行移动,无法移 动者判负.事实上,这个游戏可以认为是所有Impartial Combinatorial Games的抽象模型.也就是说,任何一个ICG都可以通过把每个局面看成一个顶点,对每个局面和它的子局面连一条有向边来抽象成这个“有向图游戏”.下 面我们就在有向无环图的顶点上定义Sprague-Garundy函数.首先定义mex(minimal excludant)运算,这是施加于一个集合的运算,表示最…
基础博弈的小结:http://blog.csdn.net/acm_cxlove/article/details/7854530 经典翻硬币游戏小结:http://blog.csdn.net/acm_cxlove/article/details/7854534 经典的删边游戏小结:http://blog.csdn.net/acm_cxlove/article/details/7854532 五篇国家集训队论文: 张一飞: <由感性认识到理性认识——透析一类搏弈游戏的解答过程 > 王晓珂:<…
转载请注明出处,谢谢http://blog.csdn.net/ACM_cxlove?viewmode=contents    by---cxlove 首先当然要献上一些非常好的学习资料: 基础博弈的小结:http://blog.csdn.net/acm_cxlove/article/details/7854530 经典翻硬币游戏小结:http://blog.csdn.net/acm_cxlove/article/details/7854534 经典的删边游戏小结:http://blog.csdn…
Portal -->poj2068 Description ​  给你\(S\)个石子,有\(2n\)个人分成两队,编号为奇数的一队,编号为偶数的一队,\(2n\)个人按照编号从小到大的顺序拿石子,所有人都拿过了就再从\(1\)号轮,编号为\(i\)的人一次可以拿\(x\in[1,a[i]]\)颗,拿到最后一颗石子的队伍输,判断当前局面是否先手必胜 Solution ​  emmm今天做了几道sg函数的题然后感觉这玩意很神秘 ​​  除了转化成"有向图游戏"那样的形式之后用异或和…
You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the winner. You will take the first turn to remove th…
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概率是在正面,各个卡牌独立.求把所有卡牌来玩Nim游戏,先手必胜的概率. (⊙o⊙)-由于本人只会在word文档里写公式,所以本博客是图片格式的. Code #include <cstdio> #include <cstring> #include <algorithm> u…
A Simple Nim Problem Description   Two players take turns picking candies from n heaps,the player who picks the last one will win the game.On each turn they can pick any number of candies which come from the same heap(picking no candy is not allowed)…