結果

問題 No.1385 Simple Geometry 2
ユーザー pockyny
提出日時 2021-02-14 15:11:26
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 662 bytes
コンパイル時間 3,178 ms
コンパイル使用メモリ 78,296 KB
最終ジャッジ日時 2025-01-18 20:19:51
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 WA * 6 TLE * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
using namespace std;
typedef long double ld;
ld t[500010],pi = acos(-1);
int main(){
    cout.precision(20);
    int i,n; ld l;
    cin >> n >> l;
    for(i=0;i<n;i++) cin >> t[i];
    ld s = 0,c = 0,ans = 0;
    ld ans2 = 0;
    for(i=n - 1;i>=0;i--){
        ans += ld(n + 2*i)*(s*cos(2*pi*t[i]/l) - c*sin(2*pi*t[i]/l));
        s += sin(2*pi*t[i]/l); c += cos(2*pi*t[i]/l);
    }
    s = 0; c = 0;
    for(i=0;i<n;i++){
        ans += ld(2*i)*(s*cos(2*pi*t[i]/l) - c*sin(2*pi*t[i]/l));
        s += sin(2*pi*t[i]/l); c += cos(2*pi*t[i]/l);
    }
    ans *= 3;
    ans /= (ld)(n*(n - 1)*(n - 2));
    cout << ans << endl;
}
0