結果

問題 No.65 回数の期待値の練習
ユーザー yuppe19 😺yuppe19 😺
提出日時 2015-04-28 12:34:45
言語 Python2
(2.7.18)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 250 bytes
コンパイル時間 446 ms
コンパイル使用メモリ 6,636 KB
実行使用メモリ 7,880 KB
最終ジャッジ日時 2023-09-18 14:03:10
合計ジャッジ時間 2,486 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
7,780 KB
testcase_01 AC 24 ms
7,648 KB
testcase_02 AC 23 ms
7,644 KB
testcase_03 AC 23 ms
7,652 KB
testcase_04 AC 24 ms
7,660 KB
testcase_05 AC 24 ms
7,780 KB
testcase_06 AC 24 ms
7,640 KB
testcase_07 AC 23 ms
7,620 KB
testcase_08 AC 24 ms
7,832 KB
testcase_09 AC 24 ms
7,632 KB
testcase_10 AC 24 ms
7,880 KB
testcase_11 AC 24 ms
7,640 KB
testcase_12 AC 23 ms
7,640 KB
testcase_13 AC 24 ms
7,628 KB
testcase_14 AC 24 ms
7,824 KB
testcase_15 AC 24 ms
7,720 KB
testcase_16 AC 25 ms
7,644 KB
testcase_17 AC 25 ms
7,832 KB
testcase_18 AC 25 ms
7,652 KB
testcase_19 AC 24 ms
7,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python
from fractions import Fraction
k = int(raw_input())
dp = [0] * (k+1)
for i in xrange(6):
    if k-i > 0:
        dp[k-i-1] = Fraction(7, 6) ** i
for x in reversed(xrange(k-6)):
    dp[x] = sum(dp[x+1:x+7]) / 6 + 1
print float(dp[0])
0