1# Runtime: 62 ms (Top 34.5%) | Memory: 18.09 MB (Top 39.7%)234class Solution:5def soupServings(self, n: int) -> float:6if n > 4451:7return 1.08n = (n + 24) // 259memo = dict()1011def dp(i, j):12if (i, j) in memo:13return memo[(i, j)]14if i <= 0 and j <= 0:15return 0.516if i <= 0:17return 1.018if j <= 0:19return 0.020memo[(i, j)] = 0.25 * (21dp(i - 4, j) + dp(i - 3, j - 1) + dp(i - 2, j - 2) + dp(i - 1, j - 3)22)23return memo[(i, j)]2425return dp(n, n)