atcoder#ARC122B. [ARC122B] Insurance
[ARC122B] Insurance
Score : points
Problem Statement
Snuke has read his own fortune for tomorrow, and learned that there are scenarios that can happen, one of which will happen tomorrow with equal probability. The -th scenario will cost him yen (Japanese currency).
Following this, Snuke has decided to get insurance today. If he pays yen to his insurance company, he will get compensation of yen when yen is lost. Here, he can choose any non-negative real number as .
Snuke wants to minimize the expected value of the amount of money he loses, which is . Find the minimized value.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer. Your answer will be judged correct when its absolute or relative error is at most .
3
3 1 4
1.83333333333333333333
The optimum choice is . After paying yen, one of the following three scenarios will happen with equal probability:
- Scenario : Lose yen and get compensation of yen. After all, Snuke loses yen.
- Scenario : Lose yen and get compensation of yen. After all, Snuke loses yen.
- Scenario : Lose yen and get compensation of yen. After all, Snuke loses yen.
Thus, the expected amount of money lost is yen.
10
866111664 178537096 844917655 218662351 383133839 231371336 353498483 865935868 472381277 579910117
362925658.10000000000000000000