BetTime
limit:1000MS
Memory Limit:64000KB
64bit IO Format:%lld &%l Lu SubmitStatusPracticeAcdream 1066
Description
The Josnch planet is a popular planet with a gambling wind.
Everyone is born with a certain amount of money, after all the income can only be obtained by gambling (OMG, if the RP is not good, gambled away all the money ...) )
Suppose a gambling company gambling has N results, each result can be obtained by the odds ratio is a[1],a[2]...a[n].
Assuming xxx has X dollars Now, ask him what strategy to choose to make the worst-case return the most?
Assuming that only one of the N results is in return, the X-dollar must all be used in this gamble, odds ratio is a[i], if you put in the results of the first y money, then you return is y * a[ I], the so-called strategy is how you should allocate your input on each outcome.
Example N = 2 When the odds ratio is 1, 2, you have a $, then buy the first 2000/3, after a 1000/3, so the worst case of your return is 666.67 .
Input
Multiple sets of data.
For each set of data, a number n (2≤n≤100),n is selected, the next line has n number, and the range of each number is 0.01 ~ 100.00 .
The last line is a number X (0.01≤x≤1000.00), which represents your total money.
Output
Each output line, the worst case maximum benefit, retains two decimal places.
Sample Input
21 21000
Sample Output
666.67
The students are very logical explanation: why when each return value of the same time (set at this time X), for the worst case of the maximum benefit.
Assuming that each return value is not exactly equal then there must be (>x) and (<x) elements, in the worst case, an element with a profit of (<x).
When the return value is all x, the worst yield is x > (<x) So when and only if the above conclusion .... Orz
Acdream. Bet (Mathematical deduction)