結果

問題 No.567 コンプリート
ユーザー lam6er
提出日時 2025-03-20 18:52:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 259 ms / 2,000 ms
コード長 458 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 82,664 KB
実行使用メモリ 82,700 KB
最終ジャッジ日時 2025-03-20 18:53:02
合計ジャッジ時間 4,823 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
from decimal import Decimal, getcontext

# Set a high precision to handle large exponents accurately
getcontext().prec = 1000

n = int(input())

sum_p = Decimal(0)
for k in range(0, 7):
    comb = math.comb(6, k)
    sign = (-1) ** k
    term = Decimal(comb) * Decimal(sign) * (Decimal(6 - k) / Decimal(6)) ** n
    sum_p += term

# Format the output to print up to 12 decimal places, trailing zeros may be omitted
print("{0:.12f}".format(sum_p))
0