結果

問題 No.65 回数の期待値の練習
ユーザー FromBooskaFromBooska
提出日時 2023-03-16 20:47:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 322 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 81,544 KB
実行使用メモリ 53,404 KB
最終ジャッジ日時 2023-10-18 13:11:37
合計ジャッジ時間 2,054 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,400 KB
testcase_01 AC 39 ms
53,404 KB
testcase_02 AC 39 ms
53,404 KB
testcase_03 AC 39 ms
53,404 KB
testcase_04 AC 39 ms
53,404 KB
testcase_05 AC 40 ms
53,404 KB
testcase_06 AC 39 ms
53,404 KB
testcase_07 AC 39 ms
53,404 KB
testcase_08 AC 39 ms
53,404 KB
testcase_09 AC 40 ms
53,404 KB
testcase_10 AC 39 ms
53,404 KB
testcase_11 AC 39 ms
53,404 KB
testcase_12 AC 39 ms
53,404 KB
testcase_13 AC 40 ms
53,404 KB
testcase_14 AC 39 ms
53,404 KB
testcase_15 AC 40 ms
53,404 KB
testcase_16 AC 40 ms
53,404 KB
testcase_17 AC 39 ms
53,404 KB
testcase_18 AC 38 ms
53,404 KB
testcase_19 AC 38 ms
53,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# K以上にしたいなのでKを超えてもOK
# E(K)=0+0+0+0+0+0+1? いや0でしょ
# E(K-1)=E(K)/6+E(K+1)/6+++++1 = 1

K = int(input())
sugoroku = [0]*(K+7)
for i in range(K-1, -1, -1):
    sugoroku[i] = 1
    for j in range(6):
        sugoroku[i] += sugoroku[i+j+1]/6

#print(sugoroku)

ans = sugoroku[0]
print(ans)
0