結果

問題 No.65 回数の期待値の練習
ユーザー lam6er
提出日時 2025-03-20 19:01:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 299 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 81,924 KB
実行使用メモリ 53,076 KB
最終ジャッジ日時 2025-03-20 19:02:50
合計ジャッジ時間 1,730 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

K = int(input())
if K == 0:
    print(0)
else:
    E = [0.0] * K
    for x in range(K-1, -1, -1):
        total = 0.0
        for i in range(1, 7):
            next_x = x + i
            if next_x < K:
                total += E[next_x]
        E[x] = total / 6 + 1
    print("{0:.5f}".format(E[0]))
0