#P5223. Sum over DP Table Recurrence
Sum over DP Table Recurrence
Sum over DP Table Recurrence
Given two integers N and K, you are required to compute
[ S = \sum_{i=1}^{K} f[N][i] \pmod{998244353}, ]
where the two-dimensional array (f[i][j]) is defined by the recurrence
[ f[i][j] = f[i-1][j] + f[i][j-1] + f[i-1][j-1] \quad \text{for } i > 1 \text{ and } j \leq i, ]
with the base conditions
[ f[1][1] = 1, \quad f[i][0] = 0, \quad f[i][j] = 0 \text{ for } j > i. ]
Note that when (K > N), since (f[N][j] = 0) for (j > N), only the values with (1 \leq j \leq N) will contribute to the sum.
Your task is to compute and output S modulo (998244353).
inputFormat
The input consists of a single line containing two space-separated integers, N and K.
outputFormat
Output a single integer representing the value of (S = \sum_{i=1}^{K} f[N][i]) modulo (998244353).
sample
1 1
1