結果

問題 No.1271 初めての級数
ユーザー 遭難者遭難者
提出日時 2020-09-20 16:14:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 3,907 ms
コンパイル使用メモリ 71,756 KB
実行使用メモリ 56,436 KB
最終ジャッジ日時 2023-09-06 16:22:47
合計ジャッジ時間 4,259 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
56,032 KB
testcase_01 AC 118 ms
55,988 KB
testcase_02 AC 117 ms
55,944 KB
testcase_03 AC 118 ms
56,260 KB
testcase_04 AC 116 ms
55,860 KB
testcase_05 AC 119 ms
56,248 KB
testcase_06 AC 118 ms
56,244 KB
testcase_07 AC 117 ms
55,924 KB
testcase_08 AC 126 ms
55,980 KB
testcase_09 AC 126 ms
55,700 KB
testcase_10 AC 121 ms
56,436 KB
testcase_11 AC 120 ms
55,796 KB
testcase_12 AC 121 ms
55,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
    public static void main(String[]args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = sc.nextInt();
		if(n == 0) ou.println("1.644934066848226436472");
		else{
			double yono = 0;
			for(int i = 1 ; i <= n ; i++){
				yono += 1.0 / i;
			}
			yono /= n;
			ou.println(yono);
		}
		ou.flush();
	}
}
0