結果

問題 No.1273 はじめのζ関数
ユーザー lam6er
提出日時 2025-03-31 17:23:53
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 437 bytes
コンパイル時間 391 ms
コンパイル使用メモリ 82,904 KB
実行使用メモリ 73,972 KB
最終ジャッジ日時 2025-03-31 17:24:29
合計ジャッジ時間 3,621 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 21 RE * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

x = int(input())

if x == 2:
    print(1000000)
elif x == 3:
    s = 2.0 - (math.pi ** 2) / 6.0
    res = int(s * 1e6)
    print(res)
else:
    sum_total = 0.0
    k = 2
    eps = 1e-20  # Extremely small epsilon to ensure precision
    while True:
        term = 1.0 / ((k - 1) * (k ** (x - 1)))
        if term < eps:
            break
        sum_total += term
        k += 1
    res = int(sum_total * 1e6)
    print(res)
0