結果

問題 No.75 回数の期待値の問題
ユーザー しらっ亭しらっ亭
提出日時 2015-09-14 01:13:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 277 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 10,728 KB
実行使用メモリ 8,052 KB
最終ジャッジ日時 2023-09-26 11:48:18
合計ジャッジ時間 1,531 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,804 KB
testcase_01 AC 15 ms
7,892 KB
testcase_02 AC 17 ms
7,840 KB
testcase_03 AC 16 ms
7,904 KB
testcase_04 AC 15 ms
7,720 KB
testcase_05 AC 15 ms
7,920 KB
testcase_06 AC 16 ms
7,988 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    K = int(input())

    p = [0] * (K + 1)

    p[0] = 1
    for i in range(1, K + 1):
        s = max(0, i - 6)
        p[i] = sum(p[j] / 6 for j in range(s, i))

    ek = 7 ** (K - 1) / 6 ** (K - 1)
    print(ek / p[K])


if __name__ == '__main__':
    solve()
0