Logo
(追記) (追記ここまで)

15120번 - Unloaded Die 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB108727169.608%

문제

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 expected result of rolling the die is 3.5, just like a fair die.
  • The difference between the old label and the new label on the side you change is as small as possible.

입력

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.

제한

예제 입력 1

0.16666 0.16667 0.16667 0.16666 0.16667 0.16667

예제 출력 1

0.000

예제 입력 2

0.2 0.2 0.1 0.2 0.2 0.1

예제 출력 2

1.000

힌트

출처

ICPC > Regionals > North America > Pacific Northwest Regional > 2017 Pacific Northwest Region Programming Contest > Division 2 U번

ICPC > Regionals > North America > Southeast USA Regional > 2017 Southeast USA Regional Programming Contest > Division 2 B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /