結果

問題 No.75 回数の期待値の問題
ユーザー hydruhydru
提出日時 2021-09-20 12:29:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 5,000 ms
コード長 243 bytes
コンパイル時間 1,861 ms
コンパイル使用メモリ 86,916 KB
実行使用メモリ 75,988 KB
最終ジャッジ日時 2023-09-15 09:29:03
合計ジャッジ時間 4,168 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,276 KB
testcase_01 AC 72 ms
71,328 KB
testcase_02 AC 71 ms
71,484 KB
testcase_03 AC 71 ms
71,292 KB
testcase_04 AC 72 ms
71,232 KB
testcase_05 AC 72 ms
71,276 KB
testcase_06 AC 73 ms
71,276 KB
testcase_07 AC 73 ms
71,408 KB
testcase_08 AC 76 ms
71,272 KB
testcase_09 AC 72 ms
71,396 KB
testcase_10 AC 75 ms
71,176 KB
testcase_11 AC 77 ms
71,268 KB
testcase_12 AC 72 ms
71,484 KB
testcase_13 AC 73 ms
71,396 KB
testcase_14 AC 71 ms
71,188 KB
testcase_15 AC 72 ms
71,296 KB
testcase_16 AC 73 ms
71,460 KB
testcase_17 AC 71 ms
71,220 KB
testcase_18 AC 77 ms
75,812 KB
testcase_19 AC 75 ms
75,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

k=int(input())
F=[0.0]*(k+1)
G=[0.0]*(k+1)
a=1/6

for i in range(k-1,-1,-1):
    for j in range(1,7):
        if(i+j<=k):
            F[i]+=F[i+j]*a
            G[i]+=G[i+j]*a
        else:
            F[i]+=a
    G[i]+=1

print(G[0]/(1-F[0]))
0