結果

問題 No.1271 初めての級数
ユーザー ks2mks2m
提出日時 2020-10-30 21:22:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 305 bytes
コンパイル時間 1,819 ms
コンパイル使用メモリ 71,356 KB
実行使用メモリ 56,296 KB
最終ジャッジ日時 2023-09-29 04:36:38
合計ジャッジ時間 4,548 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
56,096 KB
testcase_01 AC 139 ms
56,000 KB
testcase_02 AC 140 ms
56,296 KB
testcase_03 AC 138 ms
56,272 KB
testcase_04 AC 139 ms
55,448 KB
testcase_05 AC 140 ms
55,720 KB
testcase_06 AC 138 ms
56,016 KB
testcase_07 AC 139 ms
56,020 KB
testcase_08 AC 140 ms
55,660 KB
testcase_09 AC 139 ms
55,800 KB
testcase_10 AC 141 ms
56,016 KB
testcase_11 AC 143 ms
55,992 KB
testcase_12 AC 141 ms
56,136 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