-----------博弈论-----------
努力写题的tyf
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
博弈论学习总结
博弈论初步 必胜点和必败点的概念: P点:必败点,换而言之,就是谁处于此位置,则在双方操作正确的情况下必败。 N点:必胜点,处于此情况下,双方操作均正确的情况下必胜。 必胜点和必败点的性质: 1、所有终结点是 必败点 P 。(我们以此为基本前提进行推理,换句话说,我们以此为假设) 2、从任何必胜点N 操作,至少有一种方式可以进入必败点 P。 3、无论如何操作,必败点P 都只能进入 必...原创 2018-08-12 23:06:28 · 1244 阅读 · 0 评论 -
牛客国庆集训派对Day4 - G、I、H
G - 区间权值 题目描述 小 Bo 有 n 个正整数 a1..an,以及一个权值序列 w1…wn,现在他定义 现在他想知道 的值,需要你来帮帮他 你只需要输出答案对 109+7 取模后的值 输入描述: 第一行一个正整数 n 第二行 n 个正整数 a1..an 第三行 n 个正整数 w1..wn 输出描述: 输出答案对 109+7 取模后的值 示例1 输入 复制 ...原创 2018-10-04 19:45:47 · 347 阅读 · 3 评论 -
hdu3590 - 树的删边游戏+anti-sg
hdu3590 思路: 定理:叶子节点的sg值为0,中间节点的sg值为它的所有子节点的sg值加1后的异或和 这样写个dfs就可以很轻松的求解,我wa了两发,是因为建树的时候出错了,只建了单向的,比如说他给你的点对是(2,5)但实际上2是5的孩子,这样的话我们建(2,5)不就建错了,应该(5,2),所以我们加边的时候应该加双向边,dfs的时候设一个父节点,不让其反向走就可以了~ 代码如下: ...原创 2018-09-22 20:03:00 · 232 阅读 · 0 评论 -
hdu5795、3032 - multi-sg
multi-sg 每次操作或者取走1到a[i]个石子,或者选择把其中一堆分成x堆 先打表找规律(防超时),再计算总游戏的sg值 hdu5795 #include<iostream> #include<cstdio> #include<algorithm> #include<vector> #include<cmath> #inc...原创 2018-09-22 19:55:21 · 130 阅读 · 0 评论 -
hdu1970、2509 - Anti-sg
hdu1970 最基础的anti-sg 结论: 当且仅当: (1)所有堆的石子数都是1且游戏的sg值为0 (2)有些堆得石子数大于1且游戏的sg值不为0 先手胜。 #include<iostream> #include<cstdio> #include<algorithm> #include<vector> #include<...原创 2018-09-22 19:46:21 · 203 阅读 · 0 评论 -
hdu3980 - 博弈论
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=3980 题意: 开始有一个珠子数为n的环,每个人每次去掉m个珠子(m个必须是连续的),当轮到他是他不能去掉m个珠子,那么他就输了qwq 思路: 第一步当然是破环为链啦,变成链装的就好求了,我们破环为链后,后手先取,所以sg值!=0那么就是后手胜,反之是先手胜。 代码如下: #include...原创 2018-09-21 21:29:21 · 242 阅读 · 0 评论 -
hdu5754 - 组合博弈
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5754 思路: 具体走法在代码中标注。 type==1:找规律可以找到,若横、纵坐标都是奇数那么先手必败,(看别人的题解说是巴什博奕,但不知道为啥qwq) type==2:相当于基本的nim博弈,只能横、竖走,横走n-1,竖走m-1,把他们想象成取石子 type==3:走日分为两种走法,第一种...原创 2018-09-20 16:08:11 · 215 阅读 · 0 评论 -
hdu5996 hdu5724 - 阶梯博弈
学习文章连接:https://blog.csdn.net/kk303/article/details/6692506 hdu5724 题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=5724 代码如下:(不太懂) #include<iostream> #include<cstdio> #include<algor...原创 2018-09-20 14:33:00 · 147 阅读 · 0 评论 -
hdu4315 - 阶梯博弈
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=4315 题意:就是下面这个图,灰格子是山顶,可以站很多人,其他格子只能站一个人,红色的是king,Alice和Bob轮流移动人,不能跨越,谁先把king移到终点谁就胜利~这题是一个很好的思维题啊~(一共n个人,king在第k个位置) 思路: 这题和poj1704差不多啊,不同的就是多了一个k...原创 2018-09-24 11:04:16 · 229 阅读 · 0 评论 -
hdu3595 - 博弈论(every-sg游戏)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=3595 题解参考:https://blog.csdn.net/u012139398/article/details/38000613 代码如下: #include<iostream> #include<cstdio> #include<algorithm> #...原创 2018-09-23 21:35:06 · 271 阅读 · 0 评论 -
Wannfly挑战赛23 B、hdu1850 - 博弈论(求第1步必胜的策略数)
链接:https://www.nowcoder.com/acm/contest/161/B 题目描述 小N和小O在玩游戏。他们面前放了n堆石子,第i堆石子一开始有ci颗石头。他们轮流从某堆石子中取石子,不能不取。最后无法操作的人就输了这个游戏。但他们觉得这样玩太无聊了,更新了一下规则。具体是这样的:对于一堆有恰好m颗石子的石头堆,假如一个人要从这堆石子中取石子,设他要取石子数为d,那么d必须是...原创 2018-09-16 21:54:24 · 236 阅读 · 0 评论 -
Euclid's Game - poj2348 - 博弈论(找规律)
Euclid's Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10660 Accepted: 4340 Description Two players, Stan and Ollie, play, starting with two natural numbers. St...原创 2018-08-13 23:53:32 · 357 阅读 · 0 评论 -
A multiplication game - poj2505 - 博弈论(找规律)
A multiplication game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6765 Accepted: 3395 Description Stan and Ollie play the game of multiplication by multiplying an ...原创 2018-08-13 23:24:47 · 196 阅读 · 0 评论 -
A Chess Game - poj2425 - 博弈论(sg函数)
A Chess Game Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 4669 Accepted: 1861 Description Let's design a new chess game. There are N positions to hold M chesses in ...原创 2018-08-13 21:27:48 · 227 阅读 · 0 评论 -
A New Stone Game - poj1740 - 博弈论+找规律
A New Stone Game Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 6463 Accepted: 3537 Description Alice and Bob decide to play a new stone game.At the beginning of the ...原创 2018-08-13 00:06:05 · 158 阅读 · 0 评论 -
Cheat in the Game - poj3688 - 博弈+dp
Cheat in the Game Time Limit: 6000MS Memory Limit: 65536K Total Submissions: 1270 Accepted: 443 Description Alice and Bob are playing a game. At the beginning, the judge takes ou...原创 2018-08-12 23:35:17 · 236 阅读 · 0 评论 -
黑龙江大学程序设计竞赛(重现赛)- Bash Game - Bash博弈变形(详解)
题目描述 The two new cute boys(Alice and Bob) in the ACM group of HLJU science and technology association have been dreaming of getting these six books written by Mr Jin. As we all know, there is n...原创 2019-04-27 20:13:43 · 257 阅读 · 0 评论
分享