結果

問題 No.1385 Simple Geometry 2
ユーザー kotatsugamekotatsugame
提出日時 2021-02-07 23:04:03
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 239 ms / 500 ms
コード長 1,010 bytes
コンパイル時間 700 ms
コンパイル使用メモリ 74,344 KB
実行使用メモリ 14,224 KB
最終ジャッジ日時 2023-09-18 00:32:10
合計ジャッジ時間 18,720 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,864 KB
testcase_01 AC 2 ms
5,920 KB
testcase_02 AC 2 ms
5,856 KB
testcase_03 AC 2 ms
5,744 KB
testcase_04 AC 2 ms
5,748 KB
testcase_05 AC 2 ms
5,984 KB
testcase_06 AC 2 ms
5,752 KB
testcase_07 AC 2 ms
5,972 KB
testcase_08 AC 4 ms
5,768 KB
testcase_09 AC 4 ms
6,072 KB
testcase_10 AC 4 ms
5,772 KB
testcase_11 AC 4 ms
5,836 KB
testcase_12 AC 4 ms
5,792 KB
testcase_13 AC 238 ms
14,040 KB
testcase_14 AC 237 ms
14,204 KB
testcase_15 AC 235 ms
13,932 KB
testcase_16 AC 236 ms
13,984 KB
testcase_17 AC 237 ms
14,204 KB
testcase_18 AC 234 ms
13,980 KB
testcase_19 AC 230 ms
13,928 KB
testcase_20 AC 236 ms
13,916 KB
testcase_21 AC 239 ms
13,872 KB
testcase_22 AC 220 ms
14,164 KB
testcase_23 AC 236 ms
13,976 KB
testcase_24 AC 221 ms
13,912 KB
testcase_25 AC 223 ms
14,168 KB
testcase_26 AC 235 ms
13,916 KB
testcase_27 AC 239 ms
13,916 KB
testcase_28 AC 222 ms
13,976 KB
testcase_29 AC 236 ms
14,168 KB
testcase_30 AC 235 ms
14,160 KB
testcase_31 AC 238 ms
13,992 KB
testcase_32 AC 235 ms
13,992 KB
testcase_33 AC 236 ms
14,220 KB
testcase_34 AC 233 ms
14,164 KB
testcase_35 AC 237 ms
13,980 KB
testcase_36 AC 235 ms
13,928 KB
testcase_37 AC 237 ms
13,928 KB
testcase_38 AC 237 ms
13,972 KB
testcase_39 AC 236 ms
14,168 KB
testcase_40 AC 234 ms
13,992 KB
testcase_41 AC 237 ms
14,096 KB
testcase_42 AC 235 ms
14,164 KB
testcase_43 AC 238 ms
14,096 KB
testcase_44 AC 238 ms
14,136 KB
testcase_45 AC 239 ms
14,104 KB
testcase_46 AC 238 ms
13,912 KB
testcase_47 AC 237 ms
14,168 KB
testcase_48 AC 237 ms
13,980 KB
testcase_49 AC 237 ms
13,988 KB
testcase_50 AC 238 ms
13,976 KB
testcase_51 AC 237 ms
13,920 KB
testcase_52 AC 238 ms
14,164 KB
testcase_53 AC 237 ms
13,972 KB
testcase_54 AC 237 ms
14,100 KB
testcase_55 AC 237 ms
13,984 KB
testcase_56 AC 239 ms
13,908 KB
testcase_57 AC 237 ms
14,096 KB
testcase_58 AC 237 ms
14,224 KB
testcase_59 AC 198 ms
14,196 KB
testcase_60 AC 225 ms
14,160 KB
testcase_61 AC 222 ms
13,976 KB
testcase_62 AC 223 ms
13,932 KB
testcase_63 AC 238 ms
14,164 KB
testcase_64 AC 238 ms
13,872 KB
testcase_65 AC 239 ms
13,976 KB
testcase_66 AC 239 ms
13,940 KB
testcase_67 AC 236 ms
13,916 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    8 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int N;
long L,T[5<<17];
double p[5<<17];
main()
{
	cin>>N>>L;
	for(int i=0;i<N;i++)
	{
		cin>>T[i];
		p[i]=2*M_PI*T[i]/L;
	}
	double ans=0;
	/*
	for(int i=1;i+1<N;i++)
	{
		for(int j=0;j<i;j++)
		{
			for(int k=i+1;k<N;k++)
			{
				double alpha=p[i]-p[j],beta=p[k]-p[i];
				ans+=sin(alpha)+sin(beta)-sin(alpha+beta);
				//ans+=sin(alpha)*sin(beta)*sin(alpha+beta);
			}
		}
	}
	for(int i=0;i<N;i++)for(int j=i+1;j<N;j++)
	{
		//ans+=(i+i-j-j+N)*sin(p[j])*cos(p[i]);
		ans+=(i+i+N)*sin(p[j])*cos(p[i]);
		ans-=(j+j)*sin(p[j])*cos(p[i]);
		ans-=(i+i+N)*cos(p[j])*sin(p[i]);
		ans+=(j+j)*cos(p[j])*sin(p[i]);
	}*/
	double s1=0,s2=0,s3=0,s4=0;
	for(int j=0;j<N;j++)
	{
		ans+=s1*sin(p[j]);
		ans-=(j+j)*s2*sin(p[j]);
		ans-=s3*cos(p[j]);
		ans+=(j+j)*s4*cos(p[j]);
		s1+=(j+j+N)*cos(p[j]);
		s2+=cos(p[j]);
		s3+=(j+j+N)*sin(p[j]);
		s4+=sin(p[j]);
	}
	ans*=3;
	ans/=N;
	ans/=N-1;
	ans/=N-2;
	cout<<fixed<<setprecision(16)<<ans<<endl;
}
0