結果

問題 No.65 回数の期待値の練習
ユーザー june19312june19312
提出日時 2024-04-23 15:03:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 5,000 ms
コード長 219 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 82,104 KB
実行使用メモリ 53,988 KB
最終ジャッジ日時 2024-04-23 15:03:09
合計ジャッジ時間 1,696 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,608 KB
testcase_01 AC 38 ms
52,832 KB
testcase_02 AC 38 ms
52,936 KB
testcase_03 AC 38 ms
53,988 KB
testcase_04 AC 37 ms
52,400 KB
testcase_05 AC 38 ms
52,588 KB
testcase_06 AC 39 ms
52,000 KB
testcase_07 AC 37 ms
52,288 KB
testcase_08 AC 38 ms
53,008 KB
testcase_09 AC 39 ms
52,196 KB
testcase_10 AC 37 ms
53,816 KB
testcase_11 AC 38 ms
52,536 KB
testcase_12 AC 36 ms
52,264 KB
testcase_13 AC 38 ms
53,184 KB
testcase_14 AC 37 ms
52,752 KB
testcase_15 AC 38 ms
52,464 KB
testcase_16 AC 37 ms
52,116 KB
testcase_17 AC 38 ms
53,488 KB
testcase_18 AC 37 ms
52,688 KB
testcase_19 AC 39 ms
52,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

K = int(input())
if K == 1:
    print(1)
    exit()

dp = [-1] * (K+1)
dp[0] = 0
dp[1] = 1
for i in range(2,K+1):
    tmp = 0
    for j in range(1,7):
        tmp += (dp[max(0,i-j)]+1)/6
    dp[i] = tmp

print(dp[-1])

0