結果

問題 No.454 逆2乗和
ユーザー hotpepsi
提出日時 2016-12-05 01:22:01
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 365 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 58,612 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-30 02:31:13
合計ジャッジ時間 2,410 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>

using namespace std;
typedef long double LD;

int main(int argc, char *argv[]) {
	cout.precision(16);
	LD x;
	cin >> x;
	LD ans = 1.6449340668482264;
	for (int n = 10000000; n > 0; --n) {
		ans += 1 / ((x + n) * (x + n));
		ans -= 1 / ((LD)n * n);
	}
	cout << ans << endl;
	return 0;
}
0