dp
of size n + 1
with zeros.dp[0] = 1
as the base case.s
with 1
if k > 0
, otherwise with 0
.i
from 1
to n
:
dp[i] = s / maxPts
.i < k
, add dp[i]
to s
.i - maxPts >= 0
and i - maxPts < k
, subtract dp[i - maxPts]
from s
.dp[i]
for all k <= i <= n
.