結果

問題 No.1385 Simple Geometry 2
ユーザー convexineq
提出日時 2021-02-07 23:11:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 378 ms / 500 ms
コード長 467 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 82,500 KB
実行使用メモリ 200,312 KB
最終ジャッジ日時 2024-06-26 21:47:37
合計ジャッジ時間 26,902 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 65
権限があれば一括ダウンロードができます

ソースコード

diff #

n,L = map(int,input().split())
*a, = map(int,input().split())

from math import cos,sin,exp,pi

w = 2*pi/L
sisuu = [cos(-w*ai) + 1j*sin(-w*ai)  for ai in a]
acc = [0j]+sisuu[:]
for i in range(1,n+1):
    acc[i] += acc[i-1]

acc2 = [0j]+[i*sisuu[i] for i in range(n)]
for i in range(1,n+1):
    acc2[i] += acc2[i-1]

ans = 0j
for j in range(1,n):
    x = acc[j]*(n-2*j)
    y = acc2[j]*2
    ans += (x+y)/sisuu[j]

ans = ans.imag
p = 3/n/(n-1)/(n-2)
print(abs(ans)*p)
0