結果

問題 No.1271 初めての級数
ユーザー ks2m
提出日時 2020-10-30 21:22:41
言語 Java
(openjdk 23)
結果
AC  
実行時間 162 ms / 2,000 ms
コード長 305 bytes
コンパイル時間 2,238 ms
コンパイル使用メモリ 74,772 KB
実行使用メモリ 41,492 KB
最終ジャッジ日時 2024-07-21 23:05:05
合計ジャッジ時間 4,973 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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