結果

問題 No.1385 Simple Geometry 2
コンテスト
ユーザー Mitarushi
提出日時 2021-02-03 17:24:23
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 212 ms / 500 ms
コード長 484 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,321 ms
コンパイル使用メモリ 85,248 KB
実行使用メモリ 155,840 KB
最終ジャッジ日時 2026-03-25 21:06:14
合計ジャッジ時間 14,106 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 65
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from math import sin, cos, pi

n, l = map(int, input().split())
t = [2*pi * int(i) / l for i in input().split()]
t_sin = [sin(i) for i in t]
t_cos = [cos(i) for i in t]

a_sin = 0
a_cos = 0
for i in range(n):
    a_sin += t_sin[i] * (i-1)
    a_cos += t_cos[i] * (i-1)

b_sin = sum(t_sin)
b_cos = sum(t_cos)

ans = 0
for i in range(n):
    ans += t_sin[i] * a_cos - t_cos[i] * a_sin
    a_sin += n * t_sin[i] - b_sin
    a_cos += n * t_cos[i] - b_cos

print(ans * 3 / (n*(n-1)*(n-2)))
0