結果

問題 No.65 回数の期待値の練習
ユーザー DialBirdDialBird
提出日時 2017-02-20 20:46:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 138 ms / 5,000 ms
コード長 207 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 10,696 KB
実行使用メモリ 29,672 KB
最終ジャッジ日時 2023-08-28 21:38:39
合計ジャッジ時間 6,004 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
29,516 KB
testcase_01 AC 138 ms
29,636 KB
testcase_02 AC 134 ms
29,552 KB
testcase_03 AC 138 ms
29,512 KB
testcase_04 AC 134 ms
29,616 KB
testcase_05 AC 133 ms
29,552 KB
testcase_06 AC 134 ms
29,620 KB
testcase_07 AC 132 ms
29,672 KB
testcase_08 AC 131 ms
29,616 KB
testcase_09 AC 133 ms
29,656 KB
testcase_10 AC 138 ms
29,544 KB
testcase_11 AC 132 ms
29,544 KB
testcase_12 AC 135 ms
29,640 KB
testcase_13 AC 136 ms
29,504 KB
testcase_14 AC 136 ms
29,500 KB
testcase_15 AC 135 ms
29,556 KB
testcase_16 AC 134 ms
29,520 KB
testcase_17 AC 135 ms
29,544 KB
testcase_18 AC 137 ms
29,588 KB
testcase_19 AC 135 ms
29,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

K = int(input())
dp = np.zeros(25)
dp[K - 1] = 1

for i in reversed(range(K-1)):
    for j in range(1, 7):
        dp[i] += dp[i + j] / 6.0

    dp[i] += 1

print("{0:.4f}".format(dp[0]))
0