結果
問題 |
No.65 回数の期待値の練習
|
ユーザー |
|
提出日時 | 2024-02-25 01:08:37 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 53 ms / 5,000 ms |
コード長 | 367 bytes |
コンパイル時間 | 220 ms |
コンパイル使用メモリ | 82,468 KB |
実行使用メモリ | 62,208 KB |
最終ジャッジ日時 | 2024-09-29 10:32:23 |
合計ジャッジ時間 | 2,128 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
from collections import * from itertools import * from functools import * from heapq import * import sys, math, random, time K = int(input()) mem = [-1] * (K + 1) mem[K] = 0 mem[K - 1] = 1 def f(x): if x >= K: return 0 if mem[x] != -1: return mem[x] mem[x] = sum(f(x + i) for i in range(1, 7)) / 6 + 1 return mem[x] print(f(0))