結果

問題 No.75 回数の期待値の問題
ユーザー roiti46roiti46
提出日時 2015-10-11 21:04:52
言語 Python2
(2.7.18)
結果
AC  
実行時間 29 ms / 5,000 ms
コード長 485 bytes
コンパイル時間 402 ms
コンパイル使用メモリ 6,712 KB
実行使用メモリ 7,872 KB
最終ジャッジ日時 2023-09-28 12:15:19
合計ジャッジ時間 2,387 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
7,760 KB
testcase_01 AC 23 ms
7,768 KB
testcase_02 AC 24 ms
7,796 KB
testcase_03 AC 24 ms
7,736 KB
testcase_04 AC 23 ms
7,788 KB
testcase_05 AC 23 ms
7,740 KB
testcase_06 AC 23 ms
7,764 KB
testcase_07 AC 24 ms
7,844 KB
testcase_08 AC 24 ms
7,796 KB
testcase_09 AC 24 ms
7,732 KB
testcase_10 AC 24 ms
7,872 KB
testcase_11 AC 23 ms
7,764 KB
testcase_12 AC 23 ms
7,760 KB
testcase_13 AC 24 ms
7,800 KB
testcase_14 AC 24 ms
7,788 KB
testcase_15 AC 23 ms
7,852 KB
testcase_16 AC 26 ms
7,848 KB
testcase_17 AC 27 ms
7,792 KB
testcase_18 AC 29 ms
7,788 KB
testcase_19 AC 28 ms
7,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

def ok(k):
    dp = [0] * (K + 10)
    for i in xrange(1, K + 1):
        for j in xrange(1, 7):
            if j > i: dp[i] += k
            if i > j: dp[i] += dp[i - j]
        dp[i] = dp[i] / 6.0 + 1.0
    return dp[K] < m

K = int(raw_input())
l, r = 0.0, 1000.0
while r - l > 1e-5:
    m = (l + r) / 2
    if ok(m):
        r = m
    else:
        l = m
print "%.5f" % m;
0