結果

問題 No.75 回数の期待値の問題
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-01-18 23:04:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 62 ms / 5,000 ms
コード長 411 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 65,280 KB
最終ジャッジ日時 2024-05-02 19:37:13
合計ジャッジ時間 2,287 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
51,712 KB
testcase_01 AC 42 ms
51,968 KB
testcase_02 AC 49 ms
58,112 KB
testcase_03 AC 49 ms
59,136 KB
testcase_04 AC 47 ms
58,112 KB
testcase_05 AC 48 ms
58,624 KB
testcase_06 AC 51 ms
58,624 KB
testcase_07 AC 51 ms
59,520 KB
testcase_08 AC 53 ms
60,416 KB
testcase_09 AC 51 ms
60,672 KB
testcase_10 AC 52 ms
61,056 KB
testcase_11 AC 50 ms
60,800 KB
testcase_12 AC 49 ms
61,312 KB
testcase_13 AC 51 ms
61,312 KB
testcase_14 AC 51 ms
61,696 KB
testcase_15 AC 55 ms
62,208 KB
testcase_16 AC 60 ms
65,024 KB
testcase_17 AC 59 ms
64,384 KB
testcase_18 AC 62 ms
65,152 KB
testcase_19 AC 60 ms
65,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

k = int(input())


def calc(x):
    dp = [0]*(k+1)
    dp[k] = 0
    for i in range(k)[::-1]:
        count = 0
        for j in range(1,7):
            if i+j <= k:
                count += dp[i+j]
            else:
                count += x
        dp[i] = count/6+1

    return dp[0]

l = 0
r = 10**10

for i in range(80):
    m = (r+l)/2
    if calc(m) > m:
        l = m
    else:
        r = m
print(l)

0