結果
| 問題 |
No.76 回数の期待値で練習
|
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2024-08-26 23:41:28 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 361 bytes |
| コンパイル時間 | 453 ms |
| コンパイル使用メモリ | 82,396 KB |
| 実行使用メモリ | 848,564 KB |
| 最終ジャッジ日時 | 2024-08-26 23:41:33 |
| 合計ジャッジ時間 | 3,952 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 MLE * 1 |
ソースコード
from functools import cache
import sys
sys.setrecursionlimit(10 ** 6)
probs = [0, 1/12, 2/12, 3/12, 1/12, 3/12, 2/12]
@cache
def f(x: int) -> float:
if x <= 0: return 0
res = 0
for i in range(1, 7):
res += (f(x - i) + 1) * probs[i]
return res
T = int(input())
for _ in range(T):
N = int(input())
ans = f(N)
print(ans)
norioc