Problem 1: Screwy Pirates [Easy]
5 pirates have looted 100 coins. They must vote on how to divide them amongst each other. The voting process is the following:
Senior most pirate proposes a split
If the senior-most pirate’s plan gets at least 50% approval (he can vote for himself), the plan is passed. Otherwise he is executed and the process repeats with the next senior-most pirate.
Assume the following:
All pirates are perfectly rational and place the highest priority on staying alive
All pirates seek to maximize earnings
The pirates are blood-thirsty and will reject a plan if it doesn’t put their life in danger or cause them to earn less money
Problem 2: Generalized Screwy Pirates [Medium]
Write a program that outputs exactly how much gold each pirate gets for n pirates and k coins such that n<=k.