The pirates found 100 coins! There are N pirates in total, and the pirates decided to split it up using the pirate code. The pirate code states that the first pirate gets to be the captain first, and the captain proposes to split the coins. If half or over half of the pirates agree on the proposal(including the captain), it is passed. Otherwise, the cabin is dumped into the sea and the second pirate becomes the captain. Note that each pirate is a master logician, which means that they will always make the choice that gives them the most amount of coins and they also know that other pirates are just as smart. Being pirates, if either choice gives the same amount of coins, they will disagree just to watch the captain suffer. Determine the maximum amount of coins the first pirate can get with a given N.
1<=N<=100, the input consists a list of integers, each integer stands for the number of pirates in one case.
The output should be a list of all the maximum amount of coins the first pirate can get.
1 78 57
100 62 72
編號 | 身分 | 題目 | 主題 | 人氣 | 發表日期 |
沒有發現任何「解題報告」 |