
博弈问题
xuanweiace
一个热爱算法竞赛的弱校ACMer路过。青大本,浙大硕,方向后端开发,菜鸡一枚,奋斗ing...
展开
-
【HDU - 6662】Acesrc and Travel(树形dp,博弈dp)
题干: Acesrc is a famous tourist at Nanjing University second to none. During this summer holiday, he, along with Zhang and Liu, is going to travel to Hong Kong. There arennspots in Hong Kong, andn−1...原创 2019-11-03 16:12:23 · 437 阅读 · 0 评论 -
【牛客 - 302哈尔滨理工大学软件与微电子学院第八届程序设计竞赛同步赛(低年级)】小乐乐吃糖豆 (fIb博弈)
题干: 小乐乐是一个比较喜欢吃糖豆的小孩子,小乐乐的哥哥大乐乐也同样爱吃糖豆。 作为一个小孩子,他们永远觉得谁吃掉了最后一个糖豆,谁吃的糖豆最多。 为了公平起见小乐乐与大乐乐商量吃糖豆的规则如下: 1. 小乐乐与大乐乐轮流吃糖豆。 2. 小乐乐作为弟弟,小乐乐先吃糖豆。 3. 小乐乐第一次可以吃任意不超过n 个糖豆。(n为糖豆初始总数) 4. 后...原创 2018-12-02 22:06:23 · 736 阅读 · 0 评论 -
【LightOJ - 1031】Easy Game (区间dp,博弈)
题干: You are playing a two player game. Initially there are n integer numbers in an array and player A and B get chance to take them alternatively. Each player can take one or more numbers from the le...原创 2018-12-03 08:52:15 · 348 阅读 · 0 评论 -
【CodeForces - 299C 】Weird Game (思维,模拟,贪心,博弈,OAE思想)
题干: Yaroslav, Andrey and Roman can play cubes for hours and hours. But the game is for three, so when Roman doesn't show up, Yaroslav and Andrey play another game. Roman leaves a word for each of th...原创 2018-12-08 10:16:25 · 582 阅读 · 0 评论 -
【CodeForces - 1102C 】Doors Breaking and Repairing (思维,简单博弈)
题干: You are policeman and you are playing a game with Slavik. The game is turn-based and each turn consists of two phases. During the first phase you make your move and during the second phase Slavik...原创 2019-02-19 11:56:47 · 783 阅读 · 0 评论 -
【牛客 - 373A】翻硬币问题(博弈,结论,分析)
题干: 链接:https://ac.nowcoder.com/acm/contest/373/A 来源:牛客网 Alice和Bob正在玩一个很经典的游戏。 有nn个硬币初始时全部正面朝上,每一轮Alice必须选择其中任意的恰好mm枚硬币并将它们全部翻转,如果若干轮翻转后所有硬币全部反面朝上,那么Alice就赢得了游戏。 假设我们认为每枚硬币只有正面朝上和反面朝上两种状态且只考虑...原创 2019-03-02 18:28:56 · 1862 阅读 · 0 评论 -
【ZOJ - 3591】Nim(博弈问题,思维,STLmap)
题干: Nim is a mathematical game of strategy in which two players take turns removing objects from distinct heaps. The game ends when one of the players is unable to remove object in his/her turn. This...原创 2019-03-13 22:32:08 · 265 阅读 · 0 评论 -
【2018ACM山东省赛 - G】Games(Nim博弈 + dp)
题干: Problem Description Alice and Bob are playing a stone game. There are nnn piles of stones. In each turn, a player can remove some stones from a pile (the number must be positive and not greater ...原创 2019-05-09 21:27:28 · 386 阅读 · 2 评论 -
【HDU - 4597】Play Game(博弈dp)
题干: Alice and Bob are playing a game. There are two piles of cards. There are N cards in each pile, and each card has a score. They take turns to pick up the top or bottom card from either pile, and ...原创 2019-08-12 22:12:36 · 284 阅读 · 0 评论 -
【HDU - 5963】朋友(博弈,思维,必胜态必败态,找规律)
题干: B君在围观一群男生和一群女生玩游戏,具体来说游戏是这样的: 给出一棵n个节点的树,这棵树的每条边有一个权值,这个权值只可能是0或1。 在一局游戏开始时,会确定一个节点作为根。接下来从女生开始,双方轮流进行 操作。 当一方操作时,他们需要先选择一个不为根的点,满足该点到其父亲的边权为1; 然后找出这个点到根节点的简单路径,将路径上所有边的权值翻转(即0变成1,1 变成0 )。 当一方无法操...原创 2019-09-25 21:08:24 · 380 阅读 · 0 评论 -
【CodeForces - 151C】Win or Freeze (博弈,数学,唯一素数分解)
题干: You can't possibly imagine how cold our friends are this winter in Nvodsk! Two of them play the following game to warm up: initially a piece of paper has an integer q. During a move a player shou...原创 2018-11-21 18:54:38 · 525 阅读 · 0 评论 -
【 HDU - 1525 】Euclid's Game(较难找规律,玄学博弈,分析必败点必胜点)
题干: Two players, Stan and Ollie, play, starting with two natural numbers. Stan, the first player, subtracts any positive multiple of the lesser of the two numbers from the greater of the two numbers,...原创 2018-10-10 21:53:04 · 289 阅读 · 0 评论 -
【HDU - 1850】Being a Good Boy in Spring Festival (尼姆博弈,nim,异或前缀和)
题干: 一年在外 父母时刻牵挂 春节回家 你能做几天好孩子吗 寒假里尝试做做下面的事情吧 陪妈妈逛一次菜场 悄悄给爸爸买个小礼物 主动地 强烈地 要求洗一次碗 某一天早起 给爸妈用心地做回早餐 如果愿意 你还可以和爸妈说 咱们玩个小游戏吧 ACM课上学的呢~ 下面是一个二人小游戏:桌子上有M堆扑克牌;每堆牌的数量分别为Ni(i=1…M);两人轮流进行;每走一步可以任意选择一堆并...原创 2018-10-08 00:56:53 · 180 阅读 · 0 评论 -
【HDU - 2516 】取石子游戏 (Fibonacci博弈)
题干: 1堆石子有n个,两人轮流取.先取者第1次可以取任意多个,但不能全部取完.以后每次取的石子数不能超过上次取子数的2倍。取完者胜.先取者负输出"Second win".先取者胜输出"First win". Input 输入有多组.每组第1行是2<=n<2^31. n=0退出. Output 先取者负输出"Second win". 先取者胜输出"First win". ...原创 2018-09-24 20:09:49 · 423 阅读 · 0 评论 -
【HDU - 1564 】Play a game (博弈问题,找规律,奇偶博弈)
题干: New Year is Coming! ailyanlu is very happy today! and he is playing a chessboard game with 8600. The size of the chessboard is n*n. A stone is placed in a corner square. They play alternatively...原创 2018-09-24 20:14:09 · 479 阅读 · 0 评论 -
算法总结 -- 博弈论(PN图)
博弈论:组合博弈 * 必败点(P点) :前一个选手(Previous player)将取胜的位置称为必败点。 * 必胜点(N点) :下一个选手(Next player)将取胜的位置称为必胜点。 * 必败(必胜)点的属性:* (1) 所有终结点是必败点(P点);* (2) 从任何必胜点(N点)操作,至少有一种方法可以进入必败点(P点); * (3)无论如何操作, 从必败点(P点)都只能进入必胜点(N...转载 2018-09-20 20:42:28 · 1511 阅读 · 0 评论 -
*【HDU - 1517】【POJ - 2505】A Multiplication Game(博弈,递推找规律或SG函数)
题干: 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, ...原创 2018-09-26 21:37:56 · 258 阅读 · 0 评论 -
【UVA - 10891 Game of Sum 】【HRBUST - 1622】 Alice and Bob (区间dp,博弈问题)
题干: 有一个长度为N的整数序列,Alice和Bob轮流取数,Alice先取。每次玩家只能从左端或者右端 取一个或多个数,但不能两端都取。所有数都被取走后游戏结束,然后统计每个人取走的所有数之和, 作为各自的得分。两个人采取的策略都是让自己的得分尽量高,并且两个人都足够聪明。 Input 输入第一行为组数T(T<=10)。 对于每组数据第一行为一个整数N(1<=N<=10...原创 2018-10-13 20:47:27 · 576 阅读 · 0 评论 -
【CodeForces - 1038C】Gambling (博弈问题,优先队列模拟,贪心)
题干: Two players A and B have a list of nn integers each. They both want to maximize the subtraction between their score and their opponent's score. In one turn, a player can either add to his score ...原创 2018-10-13 21:16:13 · 385 阅读 · 0 评论 -
【HDU - 2149】Public Sale (巴什博奕)
题干: 虽然不想,但是现实总归是现实,Lele始终没有逃过退学的命运,因为他没有拿到奖学金。现在等待他的,就是像FarmJohn一样的农田生涯。 要种田得有田才行,Lele听说街上正在举行一场别开生面的拍卖会,拍卖的物品正好就是一块20亩的田地。于是,Lele带上他的全部积蓄,冲往拍卖会。 后来发现,整个拍卖会只有Lele和他的死对头Yueyue。 通过打听,Lele知道这场拍卖的...原创 2018-09-28 20:34:51 · 212 阅读 · 0 评论 -
【HDU - 3951】Coin Game (博弈,猜规律,对称博弈)
题干: After hh has learned how to play Nim game, he begins to try another coin game which seems much easier. The game goes like this: Two players start the game with a circle of n coins. They ta...原创 2018-09-28 20:49:25 · 544 阅读 · 0 评论 -
【HDU - 1527】【POJ - 1067】取石子游戏 (威佐夫博弈)
题干: 有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。 Input 输入包含若干行,表示若干种石子的初始情况,其中每一行包含两个非负整数a和b,...原创 2018-09-28 21:05:26 · 254 阅读 · 0 评论 -
【HDU - 1847】Good Luck in CET-4 Everybody! (巴什博奕,PN图或sg函数)
题干: 大学英语四级考试就要来临了,你是不是在紧张的复习?也许紧张得连短学期的ACM都没工夫练习了,反正我知道的Kiki和Cici都是如此。当然,作为在考场浸润了十几载的当代大学生,Kiki和Cici更懂得考前的放松,所谓“张弛有道”就是这个意思。这不,Kiki和Cici在每天晚上休息之前都要玩一会儿扑克牌以放松神经。 “升级”?“双扣”?“红五”?还是“斗地主”? 当然都不是!那多俗啊~ ...原创 2018-09-24 19:29:50 · 202 阅读 · 0 评论