zoj 3882 博弈 *】的更多相关文章

看了半天约数居然包括1,水了 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> #include<queue> #include<map> using namespace std; #define MOD 1000000007 const int INF=0x3f3f3f3f; ; typede…
思路:对于TT来说,如果数量分别为a a b或 a b a,或 b a a的形式,那么TT必赢,因为TT可以使其成为 a a a的形式,那么不论DD 怎么拿,都是TT最后使其成为a a a 的形式,0 0 0也是a a a的形式,故TT胜.同样,存在必败局.如果a,b,c是先手的必败局,那么将其中某个数加k,或将其中某两个数同时加k,那么就成了先手的必胜局. #include<set> #include<map> #include<cmath> #include<…
Help Bob Time Limit: 2 Seconds      Memory Limit: 65536 KB There is a game very popular in ZJU at present, Bob didn't meant to participate in it. But he decided to join it after discovering a lot of pretty girls playing it. There are n stones on the…
SG函数: 对于任意状态,定义SG(x)=mex(S),其中S是x的后继状态的SG函数值集合,mex(S)表示不再S内的最小非负整数 SG(X)=0当且仅当x为必败态. 解: 构造一个有向无环图(树),SG(x)=mex(SG(y)) y为x的孩子节点. SG(所有叶子节点)=0 #include <stdio.h> #include <algorithm> #include <string.h> #include <vector> using namesp…
感觉ZJU上有不少博弈的题目. 这道题目还是比较好理解的,题目大概意思是:两人轮流乘一个2-9的数,从1开始乘,求谁的乘积先大于N. 还是寻找必败点必胜点,不过在这个题目里转换成了寻找必败区间必胜区间的问题 以输入1000为例,我们可以倒着来,每个人除2到9之间的一个数 1000 | 999 ... 112 |    若占住999到112,则对手必胜. 必须让对手占领此段. 1000 | 999 ... 112 | 111 ... 56 |   因此必占段是 111 -? .如果56被对手占住,…
A Game Between Alice and Bob Time Limit: 5 Seconds      Memory Limit: 262144 KB Alice and Bob play the following game. A series of numbers is written on the blackboard. Alice and Bob take turns choosing one of the numbers, and replace it with one of…
Beans Game Time Limit: 5 Seconds Memory Limit: 32768 KB There are three piles of beans. TT and DD pick any number of beans from any pile or the same number from any two piles by turns. Who get the last bean will win. TT and DD are very clever. Input…
本题涉及博弈论中的Nim游戏博弈. Nim游戏博弈详解链接: http://www.cnblogs.com/exponent/articles/2141477.html 本题解题报告详解链接: http://blog.csdn.net/woshi250hua/article/details/7824609 我的代码,写的较挫,4000多ms,压着时间过,时间限制是5s.我预处理了所有1-5*10^6的数的素因子个数,用的是dp 的思想,先预处理1-5*10^6的数的最小素因子,存在a数组中,然后…
Beans Game Time Limit: 5 Seconds Memory Limit: 32768 KB There are three piles of beans. TT and DD pick any number of beans from any pile or the same number from any two piles by turns. Who get the last bean will win. TT and DD are very clever. Input…
转载请注明出处,谢谢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…