Time limit:2000/1000 MS (java/others)
Memory limit:65536/32768 K (java/others)
Problem Description
A bunch of pirates have gotten their hands on a hoard of gold pieces and wish to divide the loot. They are Democratic pirates in their own way, and it are their custom to make such divisions in the following manner:the F Iercest Pirate makes a proposal about the division, and everybody on it, votes the including. If percent or more are in favor, the proposal passes and is implemented forthwith. Otherwise the proposer is thrown overboard, and the procedure are repeated with the next fiercest pirate. The Pirates enjoy throwing one of their fellows overboard, but if given a choice they prefer cold, hard cash, the more The better. They dislike being thrown overboard themselves. All pirates are rational and know this other pirates are rational. Moreover, no two pirates are equally fierce, so there is a precise pecking order-and it are known to them all. The gold pieces are indivisible, and arrangements to share pieces-are not permitted, because no pirate trusts his FEllows to stick to such a arrangement. It ' s every man for himself. Another thing about pirates is that they are realistic. They believe ' a bird in the hand are worth two in the bush ' which means the They prefer something this is certain than a r ISK to get more, where they might lose everything. For convenience, number the Pirates in order of meekness, so this least fierce is number 1, the next least fierce Er 2 and so on. The fiercest pirate thus gets the biggest number, and proposals proceed in the order from the biggest to the least. The secret to analyzing all such games of strategy are to work backward from the end. The "place" to "start" is the "point" at which the game gets down to just two pirates, P1 and P2. Then Add in Pirate P3, P4, ..., one by one. The illustration shows the results when 3, 4, and 5 pirates try to divide of gold. Your task is to predict how many gold pieces a given pirate'll get.