結果

問題 No.1385 Simple Geometry 2
ユーザー 沙耶花
提出日時 2021-02-07 23:23:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 743 bytes
コンパイル時間 2,996 ms
コンパイル使用メモリ 193,856 KB
最終ジャッジ日時 2025-01-18 16:10:34
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 TLE * 55
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 |                 scanf("%lld",&T);
      |                 ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001

int main(){
	
	int N;
	cin>>N;
	
	long long L;
	cin>>L;
	
	double PI = acos(-1.0);
	
	vector<double> x(N),y(N);
	rep(i,N){
		long long T;
		scanf("%lld",&T);
		
		x[i] = cos(PI * 2.0 / L * T);
		y[i] = sin(PI * 2.0 / L * T);
	}
	
	double ans = 0.0;

	rep(i,N){

		double sp = 0.0,cp = 0.0;
		int cntp = 0;
		int jj = i;
		rep(j,N-1){
			jj++;
			if(jj>=N)break;
			double ss = y[jj]-y[i];
			double cc = x[jj]-x[i];
			ans += ss*cp;
			ans -= cc*sp;
			sp += ss;
			cp += cc;
		}
	}
	
	ans /= N;
	ans /= N-1;
	ans /= N-2;
	ans *= 6.0;
	ans /= 2.0;
	
	cout<<fixed<<setprecision(12)<<ans<<endl;
	
	return 0;
}
0