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

21241번 - Two Pirates - 2 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB1455100.000%

문제

Two pirates are dividing looted treasures. There are $n$ treasures, the $i$-th of which costs $a_i$ gold. They move in rotation, each turn a pirate picks one of the remaining treasures. The thing is, the second pirate is drunk, so he doesn't make optimal picks and each turn just picks a random available treasure, uniformly. The first pirate knows that and always makes the optimal picks.

Find the expected costs of treasures picked by both pirates.

입력

Two pirates are dividing looted treasures. There are $n$ treasures, the $i$-th of which costs $a_i$ gold. They move in rotation, each turn a pirate picks one of the remaining treasures. The thing is, the second pirate is drunk, so he doesn't make optimal picks and each turn just picks a random available treasure, uniformly. The first pirate knows that and always makes the optimal picks.

Find the expected costs of treasures picked by both pirates.

출력

Output two floating point numbers: the expected costs of treasures picked by the first and the second pirates.

Absolute or relative error of the numbers shouldn't exceed 10ドル^{-9}$.

제한

예제 입력 1

2
1 3

예제 출력 1

3.000000000000000 1.000000000000000

예제 입력 2

3
2 1 4

예제 출력 2

5.500000000000000 1.500000000000000

힌트

출처

Contest > Open Cup > 2020/2021 Season > Stage 8: Grand Prix of Samara D번

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

출처

대학교 대회

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

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