結果

問題 No.65 回数の期待値の練習
ユーザー noriocnorioc
提出日時 2023-08-15 01:23:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 117 ms / 5,000 ms
コード長 240 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 86,848 KB
実行使用メモリ 72,540 KB
最終ジャッジ日時 2023-08-15 01:24:05
合計ジャッジ時間 3,757 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
72,384 KB
testcase_01 AC 114 ms
72,492 KB
testcase_02 AC 111 ms
72,340 KB
testcase_03 AC 108 ms
72,308 KB
testcase_04 AC 110 ms
72,408 KB
testcase_05 AC 109 ms
72,216 KB
testcase_06 AC 111 ms
72,300 KB
testcase_07 AC 116 ms
72,360 KB
testcase_08 AC 117 ms
72,496 KB
testcase_09 AC 115 ms
72,228 KB
testcase_10 AC 113 ms
72,408 KB
testcase_11 AC 116 ms
72,496 KB
testcase_12 AC 116 ms
72,276 KB
testcase_13 AC 114 ms
72,416 KB
testcase_14 AC 115 ms
72,540 KB
testcase_15 AC 112 ms
72,464 KB
testcase_16 AC 113 ms
72,216 KB
testcase_17 AC 115 ms
72,344 KB
testcase_18 AC 111 ms
72,464 KB
testcase_19 AC 113 ms
72,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import cache
import sys
sys.setrecursionlimit(10 ** 6)


@cache
def f(n: int):
    if n <= 0: return 0
    res = 1
    for i in range(1, 7):
        res += f(n - i) / 6
    return res


K = int(input())
ans = f(K)
print(ans)
0