結果

問題 No.454 逆2乗和
ユーザー bal4u
提出日時 2019-07-21 17:47:52
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 298 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 29,184 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-22 14:02:25
合計ジャッジ時間 1,225 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

// yukicoder: No.454 逆2乗和
// 2019.7.21 bal4u

#include <stdio.h>

#define LIM 100000

int main()
{
	int n;
	double x, t, ans;
	
	scanf("%lf", &x);
	ans = 1.0/(x+LIM), t = (x+LIM)*(x+LIM);
	for (n = LIM; n > 1; n--) {
		t += 1-2*(x+n);
		ans += 1.0/t;
	}
	printf("%.15lf\n", ans);
	return 0;
}
0