結果

問題 No.1385 Simple Geometry 2
ユーザー MitarushiMitarushi
提出日時 2021-02-07 19:56:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 191 ms / 500 ms
コード長 1,019 bytes
コンパイル時間 2,194 ms
コンパイル使用メモリ 198,280 KB
実行使用メモリ 39,256 KB
最終ジャッジ日時 2023-09-17 18:35:35
合計ジャッジ時間 17,498 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 4 ms
4,380 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 4 ms
4,380 KB
testcase_13 AC 186 ms
39,056 KB
testcase_14 AC 184 ms
39,064 KB
testcase_15 AC 188 ms
39,092 KB
testcase_16 AC 188 ms
39,200 KB
testcase_17 AC 189 ms
39,064 KB
testcase_18 AC 187 ms
39,028 KB
testcase_19 AC 183 ms
39,068 KB
testcase_20 AC 184 ms
39,052 KB
testcase_21 AC 186 ms
39,064 KB
testcase_22 AC 182 ms
39,148 KB
testcase_23 AC 185 ms
39,128 KB
testcase_24 AC 180 ms
39,076 KB
testcase_25 AC 181 ms
39,012 KB
testcase_26 AC 183 ms
39,072 KB
testcase_27 AC 184 ms
39,140 KB
testcase_28 AC 182 ms
39,064 KB
testcase_29 AC 183 ms
39,188 KB
testcase_30 AC 184 ms
39,064 KB
testcase_31 AC 184 ms
39,204 KB
testcase_32 AC 184 ms
39,060 KB
testcase_33 AC 185 ms
39,120 KB
testcase_34 AC 184 ms
39,076 KB
testcase_35 AC 185 ms
39,128 KB
testcase_36 AC 184 ms
39,068 KB
testcase_37 AC 185 ms
39,128 KB
testcase_38 AC 186 ms
39,012 KB
testcase_39 AC 184 ms
39,072 KB
testcase_40 AC 184 ms
39,216 KB
testcase_41 AC 185 ms
39,224 KB
testcase_42 AC 188 ms
39,128 KB
testcase_43 AC 183 ms
39,200 KB
testcase_44 AC 185 ms
39,124 KB
testcase_45 AC 185 ms
39,204 KB
testcase_46 AC 185 ms
39,256 KB
testcase_47 AC 185 ms
39,068 KB
testcase_48 AC 186 ms
39,124 KB
testcase_49 AC 186 ms
39,080 KB
testcase_50 AC 185 ms
39,060 KB
testcase_51 AC 185 ms
39,140 KB
testcase_52 AC 186 ms
39,076 KB
testcase_53 AC 185 ms
39,064 KB
testcase_54 AC 185 ms
39,072 KB
testcase_55 AC 185 ms
39,072 KB
testcase_56 AC 186 ms
39,256 KB
testcase_57 AC 186 ms
39,020 KB
testcase_58 AC 185 ms
39,128 KB
testcase_59 AC 172 ms
39,068 KB
testcase_60 AC 140 ms
39,196 KB
testcase_61 AC 139 ms
39,028 KB
testcase_62 AC 141 ms
39,032 KB
testcase_63 AC 191 ms
39,128 KB
testcase_64 AC 191 ms
39,072 KB
testcase_65 AC 187 ms
39,060 KB
testcase_66 AC 190 ms
39,124 KB
testcase_67 AC 179 ms
39,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;
#define fi first
#define se second
#define pb push_back

const ld pi=3.141592653589793238462643383279502884197169399375105820974944;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n;
  ll l;
  cin>>n>>l;

  ll t[n];
  ld tsin[n],tcos[n],tsinsum[n+1],tcossum[n+1],p;
  tsinsum[0]=0,tcossum[0]=0;
  
  for(int i=0;i<n;i++){
    cin>>t[i];
    p=2*t[i];
    p*=pi;
    p/=l;
    tsin[i]=sin(p),tcos[i]=cos(p);
    tsinsum[i+1]=tsinsum[i]+tsin[i];
    tcossum[i+1]=tcossum[i]+tcos[i];
  }
  
  ld sinsum=0,cossum=0;
  for(int i=1;i<n;i++){
    sinsum+=tsin[i]*(i-1);
    cossum+=tcos[i]*(i-1);
  }
  
  ld ans=0;
  
  for(int i=0;i<n;i++){
    ans+=tsin[i]*cossum-tcos[i]*sinsum;
    sinsum-=tsinsum[n],cossum-=tcossum[n];
    sinsum+=tsin[i]*(n-1)+tsin[(i+1)%n],cossum+=tcos[i]*(n-1)+tcos[(i+1)%n];
  }
  
  ans*=3;
  ans/=n;
  ans/=n-1;
  ans/=n-2;
  cout<<fixed<<setprecision(30);
  cout<<ans<<endl;
}
0