結果

問題 No.1278 どんな級数?
ユーザー lam6er
提出日時 2025-04-16 16:12:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 533 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 82,440 KB
実行使用メモリ 66,848 KB
最終ジャッジ日時 2025-04-16 16:17:37
合計ジャッジ時間 4,819 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1 WA * 36 RE * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

def compute_zeta_minus_1(K):
    if K == 1:
        return 0.5
    s = 0.0
    n = 2
    while True:
        term = 1.0 / (n ** K)
        if term < 1e-15:  # Term is negligible for the required precision
            break
        s += term
        n += 1
    return s

X, K = map(int, input().split())

if X == 1:
    result = (0.75) ** K
    print("{0:.10f}".format(result))
elif X == 2:
    if K == 1:
        print("0.5000000000")
    else:
        res = compute_zeta_minus_1(K)
        print("{0:.10f}".format(res))
0