Участник:DChulkov/Leet1
Материал из DISCOPAL
https://leetcode.com/problems/new-21-game/submissions/
class Solution: def new21Game(self, N: int, K: int, W: int) -> float: if K == 0: return 1 S = 1.0 p = [1.0] + [0] * N for i in range(1, N + 1): p[i] = S / W if i < K: S += p[i] if 0 <= i - W < K: S -= p[i - W] return sum(p[K:])