結果

問題 No.1271 初めての級数
ユーザー tentententen
提出日時 2020-11-04 10:44:07
言語 Java21
(openjdk 21)
結果
AC  
実行時間 190 ms / 2,000 ms
コード長 275 bytes
コンパイル時間 3,179 ms
コンパイル使用メモリ 70,696 KB
実行使用メモリ 56,260 KB
最終ジャッジ日時 2023-09-29 15:41:28
合計ジャッジ時間 6,464 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 185 ms
53,548 KB
testcase_01 AC 186 ms
56,028 KB
testcase_02 AC 187 ms
56,160 KB
testcase_03 AC 187 ms
56,040 KB
testcase_04 AC 188 ms
55,692 KB
testcase_05 AC 186 ms
55,988 KB
testcase_06 AC 190 ms
56,032 KB
testcase_07 AC 186 ms
56,028 KB
testcase_08 AC 187 ms
55,832 KB
testcase_09 AC 187 ms
56,260 KB
testcase_10 AC 187 ms
55,668 KB
testcase_11 AC 186 ms
55,916 KB
testcase_12 AC 187 ms
56,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		double k = sc.nextInt();
		double ans = 0;
		for (int i = 1; i < 10000000; i++) {
		    ans += 1 / (i * (i + k));
		}
		System.out.println(ans);
	}
}
0