結果

問題 No.1271 初めての級数
ユーザー ks2mks2m
提出日時 2020-10-30 21:22:41
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 305 bytes
コンパイル時間 1,802 ms
使用メモリ 38,888 KB
最終ジャッジ日時 2023-02-21 10:29:50
合計ジャッジ時間 4,477 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 122 ms
37,608 KB
testcase_01 AC 125 ms
37,864 KB
testcase_02 AC 124 ms
37,720 KB
testcase_03 AC 121 ms
37,784 KB
testcase_04 AC 121 ms
37,540 KB
testcase_05 AC 123 ms
37,748 KB
testcase_06 AC 119 ms
37,768 KB
testcase_07 AC 118 ms
37,708 KB
testcase_08 AC 124 ms
37,828 KB
testcase_09 AC 125 ms
38,004 KB
testcase_10 AC 118 ms
37,756 KB
testcase_11 AC 129 ms
38,888 KB
testcase_12 AC 123 ms
37,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		sc.close();

		double ans = 0;
		for (int i = 1; i < 3000000; i++) {
			ans += 1.0 / i / (i + k);
		}
		System.out.println(ans);
	}
}
0