結果

問題 No.881 sin(x)/xの和
ユーザー chocoruskchocorusk
提出日時 2019-09-07 16:52:27
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 927 bytes
コンパイル時間 728 ms
コンパイル使用メモリ 98,108 KB
実行使用メモリ 12,324 KB
最終ジャッジ日時 2023-09-09 04:51:59
合計ジャッジ時間 7,243 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
double sinc(double x){
	if(abs(x)<1e-7) return 1.0;
	else return sin(x)/x;
}
int main()
{
	int n; cin>>n;
	double ans=0;
	double a[1010], x[1010];
	for(int i=0; i<n; i++){
		cin>>x[i]>>a[i];
		x[i]-=floor(x[i]);
	}
	for(int i=0; i<n; i++){
		for(int j=-100000; j<=100000; j++){
			if(abs(j)==1 && x[i]<1e-10) continue;
			ans-=a[i]*(1/(x[i]+j+1)/(x[i]+j-1))*sinc(x[i]+j)/(2*sin(0.5)*sin(0.5));
		}
	}
	printf("%.10lf\n", ans);
	return 0;
}
0