結果

問題 No.1235 ζ関数
ユーザー tentententen
提出日時 2020-09-23 22:55:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 173 ms / 2,000 ms
コード長 293 bytes
コンパイル時間 1,967 ms
コンパイル使用メモリ 71,652 KB
実行使用メモリ 56,512 KB
最終ジャッジ日時 2023-09-10 13:10:17
合計ジャッジ時間 6,916 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 172 ms
55,952 KB
testcase_01 AC 156 ms
55,572 KB
testcase_02 AC 156 ms
56,064 KB
testcase_03 AC 156 ms
55,940 KB
testcase_04 AC 173 ms
55,580 KB
testcase_05 AC 157 ms
55,604 KB
testcase_06 AC 156 ms
56,132 KB
testcase_07 AC 155 ms
55,812 KB
testcase_08 AC 155 ms
55,620 KB
testcase_09 AC 156 ms
56,040 KB
testcase_10 AC 156 ms
56,076 KB
testcase_11 AC 158 ms
55,612 KB
testcase_12 AC 155 ms
55,920 KB
testcase_13 AC 155 ms
56,128 KB
testcase_14 AC 154 ms
55,904 KB
testcase_15 AC 158 ms
55,912 KB
testcase_16 AC 171 ms
56,156 KB
testcase_17 AC 155 ms
56,512 KB
testcase_18 AC 158 ms
56,092 KB
testcase_19 AC 160 ms
55,844 KB
testcase_20 AC 158 ms
55,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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