結果
| 問題 |
No.1235 ζ関数
|
| ユーザー |
tenten
|
| 提出日時 | 2022-08-04 16:32:45 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 85 ms / 2,000 ms |
| コード長 | 1,077 bytes |
| コンパイル時間 | 2,062 ms |
| コンパイル使用メモリ | 78,136 KB |
| 実行使用メモリ | 44,980 KB |
| 最終ジャッジ日時 | 2025-06-20 11:06:45 |
| 合計ジャッジ時間 | 4,874 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner();
int n = sc.nextInt();
double ans = 0;
for (int i = 1000000; i >= 1; i--) {
ans += 1 / Math.pow(i, n);
}
System.out.println(new java.math.BigDecimal(ans).toPlainString());
}
}
class Scanner {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer("");
public Scanner() throws Exception {
}
public int nextInt() throws Exception {
return Integer.parseInt(next());
}
public long nextLong() throws Exception {
return Long.parseLong(next());
}
public double nextDouble() throws Exception {
return Double.parseDouble(next());
}
public String next() throws Exception {
while (!st.hasMoreTokens()) {
st = new StringTokenizer(br.readLine());
}
return st.nextToken();
}
}
tenten