
ACM_博弈论
文章平均质量分 80
深海沧澜夜未央
这个作者很懒,什么都没留下…
展开
-
Tic-Tac-Toe(三子连)(总结规律)
Time Limit: 1000 mSec Memory Limit : 262144 KB Problem DescriptionKim likes to play Tic-Tac-Toe.Given a current state, and now Kim is going to take his next move. Please tell Kim if he ca原创 2017-07-22 22:23:46 · 8138 阅读 · 0 评论 -
HDU 1848 Fibonacci again and again (SG函数 模板)
感觉教练挂上去的题目好难,实在切不动了,找一些水题慢慢提升水平吧Problem Description任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的:F(1)=1;F(2)=2;F(n)=F(n-1)+F(n-2)(n>=3);所以,1,2,3,5,8,13……就是菲波那契数列。在HDOJ上有不少相关的题目,比如1005原创 2017-08-13 17:52:00 · 264 阅读 · 0 评论 -
HDU 1730 Northcott Game (Nim博弈)
Problem Description Tom和Jerry正在玩一种Northcott游戏,可是Tom老是输,因此他怀疑这个游戏是不是有某种必胜策略,郁闷的Tom现在向你求救了,你能帮帮他么?游戏规则是这样的: 如图所示,游戏在一个n行m列(1 ≤ n ≤ 1000且2 ≤ m ≤ 100)的棋盘上进行,每行有一个黑子(黑方)和一个白子(白方)。执黑的一方先行,每次玩家可以移动原创 2017-08-10 12:26:41 · 419 阅读 · 0 评论 -
HDU 1907 John (Nim博弈 模板)
题意:约翰和他哥哥玩一个游戏,n堆糖果,每堆糖果Ai个,约翰先拿任意个同一种的糖果,然后轮到他的哥哥拿任意个同一种的糖果。谁最后拿完最后一堆的最后一个糖果,谁获胜。Nim博弈的模板题目。#include #include #include #include using namespace std;int main(){ int t; sca原创 2017-08-09 13:31:25 · 435 阅读 · 1 评论 -
HDU 1517 A Multiplication Game (组合博弈 ceil函数向下取整数 模板)
Stan and Ollie play the game of multiplication by multiplying an integer p by one of the numbers 2 to 9. Stan always starts with p = 1, does his multiplication, then Ollie multiplies the number, then原创 2017-08-06 17:43:11 · 385 阅读 · 0 评论 -
HDU 2147 kiki's game (巴什博弈)
Recently kiki has nothing to do. While she is bored, an idea appears in his mind, she just playes the checkerboard game.The size of the chesserboard is n*m.First of all, a coin is placed in the top ri原创 2017-08-06 17:25:55 · 232 阅读 · 0 评论 -
2018年全国多校算法寒假训练营练习比赛(第五场) G 送分啦-QAQ HDU 2516 斐波拉底博弈
题目描述 幼儿园开学了,为了让小盆友们能尽可能的多的享受假期。校长大人决定让小盆友分批到校,至于每批学生来多少人由一个小傻子和一个小仙女负责,两个人轮番负责,校长会在最后的时候去查看工作进度,小傻子不想被别人嘲笑自己傻,小仙女要证明自己比小傻子聪明。所以她们回去争抢安排最后一名小盆友。每次安排的小盆友至少为1,至多为上一次安排的2倍。小仙女抢到了先手的机会。第一次安排小盆友不能直接安排所有...原创 2018-02-26 09:28:57 · 318 阅读 · 0 评论 -
AtCoder Regular Contest 094 E - Tozan and Gezan (博弈论 2个和相同序列双方轮流减一得最后完全相同序列)
Problem StatementYou are given sequences A and B consisting of non-negative integers. The lengths of both A and B are N, and the sums of the elements in A and B are equal. The i-th element in A is Ai,...原创 2018-04-09 09:17:04 · 720 阅读 · 0 评论 -
新疆大学ACM-ICPC程序设计竞赛五月月赛(同步赛) G chess(威佐夫博奕)
A single chess queen is placed somewhere on a grid of 10000*10000 squares.Lao Wang and Xiao Ren ready to play a game The rules are player can move the queen towards the lower left corner of the grid:...原创 2018-05-02 10:34:08 · 251 阅读 · 0 评论 -
POJ 2975 Nim (Nim的证明)
题意:给定一种Nim状态(相当于含N堆石头),求能有几种方法能通过调整某一堆石头的状态(只准取出),使新的Nim状态为必败态。(或者说求出所给的Nim游戏状态有多少种方法能够赢)思路:Nim结论的应用在证明Nim游戏的SG函数的“根据这个判断被判为N-position的局面一定可以移动到某个P-position”命题时,有这么一段证明:对于某个局面(a1,a2,...,an),若a1^a2原创 2017-08-14 11:21:31 · 264 阅读 · 0 评论 -
POJ 1067 取石子游戏 (威佐夫博奕 Wythoff Game 模板)
Description有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。Input输入包含若干行,表示若干种石子的初始情况,其中每一行原创 2017-08-14 13:55:53 · 420 阅读 · 1 评论 -
POJ 2484 A Funny Game(规律直推)
Alice and Bob decide to play a funny game. At the beginning of the game they pick n(1 6) coins in a circle, as Figure 1 shows. A move consists in removing one or two adjacent coins, leaving all other原创 2017-08-14 14:24:04 · 398 阅读 · 0 评论 -
趣味程序设计_抢n游戏(总结规律)
题目描述这是中国民间的一个游戏。两人从1开始轮流报数,每人每次可报一个数或两个连续的数,谁先报到n(n,谁就为胜方。现要你判断是先手胜还是后手胜。输入有多组数据,每一行只有一个n; 输出如果是先手胜,输出no,否则输出yes; 样例输入10样例输出no思路:如果是3的倍数则后手赢,否则先手赢#include #include原创 2017-02-22 14:54:15 · 5039 阅读 · 2 评论 -
POJ 2348 Euclid's Game( 总结规律+组合博弈 )
题意:给出2个数字a,b( 假设a>b ),两人轮进行如下操作,将b减去a的任意倍,所得的结果要大于等于0,如果等于0则该人胜利,问谁会取得这场游戏的胜利。思路:如果b是a的整数倍,则直接获得胜利原创 2017-08-18 16:55:40 · 422 阅读 · 0 评论 -
POJ 2068 Nim (记忆化搜索+组合博弈)
题意:S个石头,双方n个人,每个人最多可以一次拿Si个石头,问先手有没有必胜策略思路:记忆化搜素+组合博弈。(枚举出所有的情况)#include #include #include #include #define N 30#define M 10000using namespace std;int f[N][M],a[N],n,m;// 1为败 0为胜int dfs(i原创 2017-08-17 15:45:49 · 399 阅读 · 0 评论 -
POJ 1740 A New Stone Game (总结发现规律)
题意:n堆石头,2个人轮流操作,操作第一步,从某一堆石头中去除至少一个石头,操作第二步从同一个石头堆中抽任意个或者不抽跳过第二步。思路:总结发现规律,如果石头堆数是奇数则先手必赢,如果是偶数的话,对石头堆从小到大排序,如果每2个一组的石头数都相等的话,先手赢,否则输#include #include #include #include using namespace std;in原创 2017-08-16 17:31:12 · 386 阅读 · 0 评论 -
POJ 1704 Georgia and Bob ( 阶梯博弈 模板 )
Georgia and Bob decide to play a self-invented game. They draw a row of grids on paper, number the grids from left to right by 1, 2, 3, ..., and place N chessmen on different grids, as shown in the fo原创 2017-08-16 14:15:50 · 383 阅读 · 0 评论 -
POJ 2960 S-Nim (SG定理的典型应用)
题意:有n堆石头,每堆石头的个数已知,两人轮流从中取石头,每次取石头的个数来自集合S,问先拿者是否有必胜策略思路:SG定理的应用,SG[i]=i(Nim博弈),先求出所有的SG值,贮存在数组中(可以与HDU 1848对比)#include #include #include using namespace std;int s[101];int k;int sg[10050];原创 2017-08-15 21:05:10 · 305 阅读 · 0 评论 -
POJ 2425 A Chess Game(联合组合博弈+树 无向无环图 )
首先介绍下联合组合博弈,联合组合就是多个组合博弈,以 POJ 2599 为例 此题目就是它的联合组合的题目,需要用到SG定理DescriptionLet's design a new chess game. There are N positions to hold M chesses in this game. Multiple chesses can be locate原创 2017-08-15 15:22:54 · 390 阅读 · 1 评论 -
POJ 2599 A funny game(组合博弈 P/N态+记忆化搜索)
DescriptionThere are several airports in one country, and there are flights between some of them. One can fly from any airport to any other, probably with some changes. For any pair of airports th原创 2017-08-15 12:12:18 · 456 阅读 · 0 评论 -
Kattis - multiplicationgame Multiplication Game 博弈因子相乘是否等于N
Alice and Bob are in their class doing drills on multiplication and division. They quickly get bored and instead decide to play a game they invented.The game starts with a target integer N≥2, and an...原创 2018-07-30 11:03:56 · 364 阅读 · 0 评论