結果

問題 No.454 逆2乗和
ユーザー 37zigen
提出日時 2016-12-01 00:37:37
言語 Java
(openjdk 23)
結果
AC  
実行時間 223 ms / 2,000 ms
コード長 541 bytes
コンパイル時間 3,507 ms
コンパイル使用メモリ 74,956 KB
実行使用メモリ 41,932 KB
最終ジャッジ日時 2024-11-30 02:24:12
合計ジャッジ時間 11,012 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.*;

public class Q1436 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double res = Math.PI * Math.PI / 6;
		double ans = 0;
		double i = 1;
		double x = sc.nextDouble();
		ans = 0;
		i = 1;
		int d = (int) x;
		for (double j = 1; j <= d; ++j)
			res -= 1 / (j * j);
		for (; res - res * Math.pow(Math.E, -x / i) > 0.0000000001; ++i) {
			ans += 1 / ((i + x) * (i + x));
			res -= 1 / ((i + d) * (i + d));
		}
		ans += res;

		System.out.printf("%.20f\n", ans);
	}
}
0