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

21081번 - Wandering 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB66514379.630%

문제

Rikka is a talented student.

She likes to wander in the corridor while solving ICPC problems. Specifically, she will do a random walk for $n$ steps. In the $i$-th random step, she will choose one of the vectors $(x, y)$ such that $x, y \in \mathbb{R}$ and $x^2 + y^2 \le R_i^2$ with equal probability. And then she will walk along the vector. In other words, if she stood at $(A, B)$ before the random step, she will stand at $(A + x, B + y)$ afterwards. Before wandering, she stands at the door $(0, 0)$.

After wandering, she was curious about the expectation of the square of Euclidean distance to point $(0, 0)$. In other words, she wants to know the expected value of $x^2 + y^2,ドル if she stands at $(x, y)$ after all $n$ random steps.

입력

The first line contains an integer $n,ドル the number of random steps.

The second line contains $n$ positive integers $R_i,ドル the parameter of the $i$-th random step.

It is guaranteed that 1ドル \le n \le 50,000円$ and 1ドル \le R_i \le 1000$.

출력

You need to output $d,ドル the expected value of $x^2 + y^2$. Assuming the correct result is $d^*,ドル you need to ensure that $\frac{|d - d^*|}{\max\{d^*, 1\}} \leq 10^{-6}$.

제한

예제 입력 1

3
1 2 3

예제 출력 1

7.000000000000000

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2021 > Day 4: PKU Contest 1, ICPC Camp Day 2 J번

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

출처

대학교 대회

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

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