結果
問題 | No.65 回数の期待値の練習 |
ユーザー |
|
提出日時 | 2022-11-24 14:40:16 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 28 ms / 5,000 ms |
コード長 | 322 bytes |
コンパイル時間 | 139 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-10-01 05:35:50 |
合計ジャッジ時間 | 1,383 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
from functools import lru_cache def main(): K = int(input()) @lru_cache def expect_dice_sum_K(now: int) -> int: if now >= K: return 0 return sum(expect_dice_sum_K(now+next_) for next_ in range(1, 7))/6 + 1 print(expect_dice_sum_K(0)) if __name__ == "__main__": main()