The question of the Pirates ' separation of gold

Source: Internet
Author: User

The pirate split seems like an old game-theory problem.

The undergraduate time listens to GXL to talk about the question itself, has not solved. Yesterday, LX asked me this question. Think about the solution, don't know right, write here.

The popular problem is this:

Five pirates grabbed 100 gold coins, and they decided to score:

1. Draw the lottery to determine your number: 5 4 3 2 1;

2. First, the allocation scheme is proposed by number 5th, and then 5 people vote jointly, and if half or more of the people agree, they are allocated according to his proposal, or 5th will be thrown into the sea to feed the sharks;

3. After the death of No. 5th, the distribution scheme was proposed by number 4th, and 4 votes were taken, and if half or more of the people agreed, they were allocated according to his proposal, or 4th would be thrown into the sea to feed the sharks;

4. By the second analogy.

Pirates make their decisions based on three factors:

1. To be able to survive;

2. Maximize the benefits you get;

3. In the same circumstances as all other conditions, the preference is to throw someone out of the boat.

Question: How does the first pirate who proposes a distribution plan be able to avoid the sea and get the most gold coins?

When we talked about the problem yesterday, it was said that more than half of the people agreed. Only half of them will be thrown into the sea.

Then, according to the original question, say "half and more than half of the consent" scenario:

5 persons in the case, number 5th if you want to propose a plan, you have to consider the number 1th to 4th in the mind is how to think. Number 1th to 4th. I must think so: is your current plan for me to earn more, or you die after the remaining 4 people assigned me to earn more?

So according to this idea, we should first analyze two people (only numbers 1th and 2nd), the case of 2nd should be how to allocate.

Number 2nd will certainly give 100 gold coins to themselves, 0 gold coins to 1th number.

No. 2nd, number 1th.

100 0 x

Then when there are 3rd, 2nd and 1th, as long as 3rd to 1th gold coins (or more), then 1 will be in favor of the 1th number. If No. 3rd does not give 1th gold, then 1th would prefer the plan of 3rd was overturned, the number 3rd was thrown out of the boat.

No. 3rd, number 2nd, number 1th.

99 x 0 One

When there are numbers 4th, 3rd, 2nd and 1th, fourth will be able to allocate gold coins according to its own plan as long as the 1 leagues are to be earned:

No. 4th No. 3rd No. 2nd No. 1th

99 x 0 One 0

When 5 pirates, number 5th to fight for 2 leagues:

No. 5th No. 4th No. 3rd No. 2nd No. 1th

98, 0, one, 0, one, two.

The answer is complete.

If you want more than half of the pirates to agree with the situation:

Only 2nd and 1th, 2nd to win 1th also agree, otherwise deadlocked (because more than half of the need, here to two people agree), then:

No. 2nd, number 1th.

50 50 X

When there are only numbers 3rd, 2nd and 1th, 3rd will strive for 1 leagues:

No. 3rd, number 2nd, number 1th.

49 51 out of 0

Or 49 of 0 51

When there are number 4th, 3rd, 2nd, 1th, 4th to fight for two leagues, because in only three people, the 2nd gold coin is expected to be 51*50% = 25.5, 1th of the gold coin is expected to be 25.5, so if you give 2nd or 1th more than 25.5, you can:

No. 4th No. 3rd No. 2nd No. 1th

48 0 out of 26 26

When there are 5 pirates, number 5th is going to fight for two leagues:

No. 5th No. 4th No. 3rd No. 2nd No. 1th

72 x 0 One 27 0 x

Or 72 0, one, 0, 27, or two.

The answer is complete.

No matter my solution is right, this idea is derived from the idea of dynamic programming, the solution of each sub-problem is part of the big problem, is the bottom-up approach.

The question of the Pirates ' separation of gold

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.