結果

問題 No.1271 初めての級数
ユーザー 遭難者遭難者
提出日時 2020-09-20 16:12:33
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 359 bytes
コンパイル時間 1,922 ms
コンパイル使用メモリ 71,176 KB
実行使用メモリ 56,488 KB
最終ジャッジ日時 2023-09-06 16:22:52
合計ジャッジ時間 4,340 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 119 ms
56,000 KB
testcase_02 AC 118 ms
55,816 KB
testcase_03 AC 120 ms
56,024 KB
testcase_04 AC 117 ms
55,680 KB
testcase_05 AC 117 ms
55,604 KB
testcase_06 AC 117 ms
55,824 KB
testcase_07 AC 117 ms
54,448 KB
testcase_08 AC 120 ms
55,880 KB
testcase_09 AC 120 ms
55,636 KB
testcase_10 AC 117 ms
56,488 KB
testcase_11 AC 118 ms
55,632 KB
testcase_12 AC 119 ms
55,700 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();
		double yono = 0;
		for(int i = 1 ; i <= n ; i++){
			yono += 1.0 / i;
		}
		yono /= n;
		ou.println(yono);
		ou.flush();
	}
}
0