|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||512 MB||28||14||14||53.846%|
Consider a six-sided die, with sides labeled 1 through 6. We say the die is fair if each of its sides is equally likely to be face up after a roll. We say the die is loaded if it isn’t fair. For example, if the side marked 6 is twice as likely to come up as than any other side, we are dealing with a loaded die.
For any die, define the expected result of rolling the die to be equal to the average of the values of the sides, weighted by the probability of those sides coming up. For example, all six sides of a fair die are equally likely to come up, and thus the expected result of rolling it is (1 + 2 + 3 + 4 + 5 + 6)/6 = 3.5.
You are given a loaded die, and you would like to unload it to make it more closely resemble a fair die. To do so, you can erase the number on one of the sides, and replace it with a new number which does not need to be an integer or even positive. You want to do so in such a way that
The input consists of a single line containing six space-separated nonnegative real numbers v1 . . . v6, where vi represents the probability that side i (currently labeled by the number i) is rolled.
It is guaranteed that the given numbers will sum to 1.
Print, on a single line, the absolute value of the difference between the new label and old label, rounded and displayed to exactly three decimal places.
0.16666 0.16667 0.16667 0.16666 0.16667 0.16667
0.2 0.2 0.1 0.2 0.2 0.1