結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
29,480 KB
testcase_01 AC 131 ms
29,492 KB
testcase_02 AC 129 ms
29,524 KB
testcase_03 AC 136 ms
29,592 KB
testcase_04 AC 133 ms
29,596 KB
testcase_05 AC 131 ms
29,620 KB
testcase_06 AC 132 ms
29,512 KB
testcase_07 AC 130 ms
29,552 KB
testcase_08 AC 132 ms
29,516 KB
testcase_09 AC 133 ms
29,552 KB
testcase_10 AC 129 ms
29,444 KB
testcase_11 AC 132 ms
29,532 KB
testcase_12 AC 132 ms
29,568 KB
testcase_13 AC 129 ms
29,576 KB
testcase_14 AC 130 ms
29,684 KB
testcase_15 AC 130 ms
29,672 KB
testcase_16 AC 130 ms
29,580 KB
testcase_17 AC 131 ms
29,612 KB
testcase_18 AC 132 ms
29,536 KB
testcase_19 AC 131 ms
29,552 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(dp[0])
0