結果
| 問題 | No.1235 ζ関数 |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 21:08:06 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 2,000 ms |
| コード長 | 667 bytes |
| コンパイル時間 | 893 ms |
| コンパイル使用メモリ | 82,516 KB |
| 実行使用メモリ | 54,036 KB |
| 最終ジャッジ日時 | 2025-06-20 11:31:00 |
| 合計ジャッジ時間 | 2,172 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
import math
N = int(input())
if N < 10:
print(1.0)
else:
eps = 1e-12
denominator = eps * (N - 1)
if denominator <= 0:
M = 2
else:
rhs = 1.0 / denominator
expo = 1.0 / (N - 1)
nupper = rhs ** expo
M_minus_1 = math.ceil(nupper)
M = M_minus_1 + 1
total = 0.0
for i in range(1, M + 1):
term = math.exp(-N * math.log(i))
total += term
# Formatting the output to handle trailing zeros and decimal points
formatted_total = "{0:.16f}".format(total)
if '.' in formatted_total:
formatted_total = formatted_total.rstrip('0').rstrip('.')
print(formatted_total)
lam6er