HDU 1538 A Puzzle for Pirates:博弈&海盗分赃问题

Time Limit: 2000/1000 MS (Java/Others)

Memory Limit: 65536/32768 K (Java/Others)

Problem Description

A bunch of pirates have gotten their hands on a hoard of gold pieces and wish to divide the loot. They are democratic pirates in their own way, and it is their custom to make such divisions in the following manner: The fiercest pirate makes a proposal about the division, and everybody votes on it, including the proposer. If 50 percent or more are in favor, the proposal passes and is implemented forthwith. Otherwise the proposer is thrown overboard, and the procedure is repeated with the next fiercest pirate. All the pirates enjoy throwing one of their fellows overboard, but if given a choice they prefer cold, hard cash, the more the better. They dislike being thrown overboard themselves. All pirates are rational and know that the other pirates are also rational. Moreover, no two pirates are equally fierce, so there is a precise pecking order — and it is known to them all. The gold pieces are indivisible, and arrangements to share pieces are not permitted, because no pirate trusts his fellows to stick to such an arrangement. It's every man for himself. Another thing about pirates is that they are realistic. They believe 'a bird in the hand is worth two in the bush' which means they prefer something that is certain than take a risk to get more, where they might lose everything. For convenience, number the pirates in order of meekness, so that the least fierce is number 1, the next least fierce number 2 and so on. The fiercest pirate thus gets the biggest number, and proposals proceed in the order from the biggest to the least. The secret to analyzing all such games of strategy is to work backward from the end. The place to start is the point at which the game gets down to just two pirates, P1 and P2. Then add in pirate P3, P4, ... , one by one. The illustration shows the results when 3, 4 or 5 pirates try to divide 100 pieces of gold. Your task is to predict how many gold pieces a given pirate will get.

时间: 2025-01-19 20:00:06

HDU 1538 A Puzzle for Pirates:博弈&海盗分赃问题的相关文章

hdu 1857 Word Puzzle

点击打开链接hdu 1857 思路:字典树 分析: 1 题目要求的是给定的单词第一个字母在这个矩形里面的最小的坐标 2 矩形的最大500*500,单词的来源有三个方向,并且单词的起点和终点在矩形之内都是可能的.所以的如果利用枚举矩形之内的单词,那么肯定是超内存的 3 所以我们必须考虑另一种的方法就是对单词进行建字典树,那么我们只要去枚举单词的可能的起点,然后进行查找相应的单词是不是在树上,如果是的话就标记一下当前的坐标. 4 注意由于单词的来源有三个方向,但是因为要求的如果下相同的情况下要求坐标

hdu 4662 MU Puzzle 模拟

   模拟题,易知将所有U换成I,补全所有删去的U,应为2的幂,又因为每次删去2个U,即6个I,所以对6取模,发现余数只有2和4,所以如果余数为2,4则必为yes.    注意开头不为M和中间有M的情况 /* author:jxy lang:C/C++ university:China,Xidian University **If you need to reprint,please indicate the source** */ #include <iostream> #include &

《PSMove生化危机5》限量同捆版售价公布

据日本SCEJ宣布表示,随着该公司最新动态体感摇杆PlayStation Move即将发售推出,因此官方将推出把本摇杆与两款对应游戏分别同捆推出的不同摇杆游戏同梱版"PlayStation Move Biohazard 5 Alternative Edition Special Pack"(PS Move 生化危机5 AE版特别包)与"PlayStation Move Big 3 Gun Shooting Perfect Pack"(PS Move Big 3 Gu

hdu 1849 (尼姆博弈)

http://acm.hdu.edu.cn/showproblem.php?pid=1849 简单的尼姆博弈: 代码如下: #include <iostream> #include <cstdio> using namespace std; int main() { int m,n,t; while(cin>>m,m) { int ans=0; for(int i=0; i<m; i++) { cin>>n; ans^=n; } if(ans==0)

HDU 1846(巴什博弈)

Brave Game Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4050    Accepted Submission(s): 2644 Problem Description 十年前读大学的时候,中国每年都要从国外引进一些电影大片,其中有一部电影就叫<勇敢者的游戏>(英文名称:Zathura),一直到现在,我依然对于电影中的部

hdu 1079 Calendar Game 博弈

      题目就是寻找有无必胜策略     一开始看错题意了,一直想用dp预处理下,结果发现就是简单的逻辑判断.     无论向后一天还是向后一月,均会改变奇偶性,除了4.30,9.30,11.30和非润年的2.28,在几个特殊日期中向后可能会改变奇偶性.     目标日期为11.4,偶数.     因此,无特殊日期时奇数必胜     而如果先手是偶数,其必然不会进入特殊日期,因为一旦奇偶改变,必胜变为必输--     如果先手为奇数,因为不存在必改变奇偶性的日期,所以进入特殊日期后也无法改变

hdu 1850 博弈 入门

   nim变形题,要求是第一种有多少种胜法,其实就是求去掉某一堆里的一些牌,后手有没有必输测量,也就是异或为0 /* author:jxy lang:C/C++ university:China,Xidian University **If you need to reprint,please indicate the source** */ #include <iostream> #include <cstdio> #include <cstdlib> #inclu

HDU 2176(Nim博弈)

取(m堆)石子游戏 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 975    Accepted Submission(s): 582 Problem Description m堆石子,两人轮流取.只能在1堆中取.取完者胜.先取者负输出No.先取者胜输出Yes,然后输出怎样取子.例如5堆 5,7,8,9,10先取者胜,先取者第1次取时

hdu 1527

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1527 hint:威佐夫博弈 基本类似于模板 #include <iostream> #include <cmath> #include <cstdio> using namespace std; const double q = (1 + sqrt(5.0)) / 2.0; // 黄金分割数 int Wythoff(int a, int b) { if (a > b)