[Puzzle] 5 Pirates and 100 Gold Coins

[Puzzle] 5 Pirates and 100 Gold Coins的相关文章

hdu-1538 A Puzzle for Pirates

题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1538 题目类型: 模拟 题意概括: 有1~n,n个海盗,m块金子,第n个海盗要提出一个分金方案,如果有一半以上的人同意,就立刻分金,反之就将这个人扔下水里,问所有情况都是最优解的情况下,要给第p个海盗分多少金? 解题思路: 如果只有一个人,所以肯定是给自己. 如果有两个人,那么自己将所有的钱都给自己,那么自己也同意分配,就可以得到一半以上的人的同意. 如果有三个人,第一个人知道如果不同意三号,那么

HDU 1538 A Puzzle for Pirates (海盗分金问题)

A Puzzle for Pirates Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 508    Accepted Submission(s): 167 Problem Description A bunch of pirates have gotten their hands on a hoard of gold pieces a

H - Gold Coins(2.4.1)

H - Gold Coins(2.4.1) Time Limit:1000MS     Memory Limit:30000KB     64bit IO Format:%I64d & %I64u Submit Status Description The king pays his loyal knight in gold coins. On the first day of his service, the knight receives one gold coin. On each of

[ACM] POJ 2000 Gold Coins

Gold Coins Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 20913   Accepted: 13098 Description The king pays his loyal knight in gold coins. On the first day of his service, the knight receives one gold coin. On each of the next two days

Gold Coins(闲来无事水一发)

Gold Coins Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 21155 Accepted: 13265 Description The king pays his loyal knight in gold coins. On the first day of his service, the knight receives one gold coin. On each of the next two days (th

HDOJ(HDU) 2401 Baskets of Gold Coins(数列、)

Problem Description You are given N baskets of gold coins. The baskets are numbered from 1 to N. In all except one of the baskets, each gold coin weighs w grams. In the one exceptional basket, each gold coin weighs w-d grams. A wizard appears on the

hust 1170 - Baskets of Gold Coins

题目描述 You are given N baskets of gold coins. The baskets are numbered from 1 to N. In all except one of the baskets, each gold coin weighs w grams. In the one exceptional basket, each gold coin weighs w-d grams. A wizard appears on the scene and takes

codechef - Bytelandian gold coins 题解

In Byteland they have a very strange monetary system. Each Bytelandian gold coin has an integer number written on it. A coin n can be exchanged in a bank into three coins: n/2, n/3 and n/4. But these numbers are all rounded down (the banks have to ma

UVALive3045 POJ2000 ZOJ2345 Gold Coins

Regionals 2004 >> North America - Rocky Mountain 问题链接:UVALive3045 POJ2000 ZOJ2345 Gold Coins.基础练习题,用C语言编写. 题意简述:骑士第1天获得1个金币,之后的2天获得2个金币,之后的3天获得3个金币,......,之后的i天获得i个金币,.......问到第n天总共获得多少个金币. 问题分析:这是一个数列求和问题,用程序解决比用数学解决方便很多. 程序中,用数组ans[]存储金币之和,即ans[i]