結果

問題 No.75 回数の期待値の問題
ユーザー KudeKude
提出日時 2021-01-27 06:21:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 5,000 ms
コード長 279 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 86,892 KB
実行使用メモリ 76,084 KB
最終ジャッジ日時 2023-09-06 09:45:31
合計ジャッジ時間 2,956 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,080 KB
testcase_01 AC 73 ms
71,200 KB
testcase_02 AC 73 ms
71,352 KB
testcase_03 AC 73 ms
71,496 KB
testcase_04 AC 75 ms
71,360 KB
testcase_05 AC 75 ms
71,296 KB
testcase_06 AC 74 ms
71,220 KB
testcase_07 AC 74 ms
71,316 KB
testcase_08 AC 75 ms
71,444 KB
testcase_09 AC 74 ms
71,280 KB
testcase_10 AC 75 ms
71,264 KB
testcase_11 AC 71 ms
71,348 KB
testcase_12 AC 71 ms
71,524 KB
testcase_13 AC 72 ms
71,300 KB
testcase_14 AC 72 ms
71,412 KB
testcase_15 AC 73 ms
71,516 KB
testcase_16 AC 71 ms
71,320 KB
testcase_17 AC 71 ms
71,204 KB
testcase_18 AC 80 ms
75,908 KB
testcase_19 AC 77 ms
76,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

k = int(input())
e = [0] * (k + 10)
x = [0] * (k + 10)
for i in range(k + 1, k + 6):
    x[i] = 1
for i in range(k)[::-1]:
    a = b = 0
    for j in range(i + 1, i + 7):
        a += e[j]
        b += x[j]
    e[i] = a / 6 + 1
    x[i] = b / 6
ans = e[0] / (1 - x[0])
print(ans)
0