a298: The Pirate Code
標籤 :
通過比率 : 3人/3人 ( 100% ) [非即時]
評分方式:
Tolerant

最近更新 : 2023-12-12 12:42

內容

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
測資資訊:
記憶體限制: 64 MB
公開 測資點#0 (100%): 1.0s , <1K
提示 :
標籤:
出處:
[管理者:
Rayrayninja (rayrayninja)
]


編號 身分 題目 主題 人氣 發表日期
沒有發現任何「解題報告」