luogu#P5223. Function
Function
Background
recently thought of Water Triangle and felt it was too easy, so he came up with a more interesting version.
Problem Description
Given and , compute:
where:
$$f[i][j] = f[i-1][j] + f[i][j-1] + f[i-1][j-1] \ (i>1, j \leq i)$$$$f[1][1] = 1 \qquad f[i][0] = 0 \qquad f[i][j] = 0 \ (j>i)$$Input Format
The first line contains two positive integers and .
Output Format
Output one line containing the value of the expression above.
1 1
1
2 2
3
3 3
11
4 3
23
Hint
Constraints:
For of the testdata: .
For of the testdata: .
For of the testdata: .
For another of the testdata: .
For of the testdata: .
It is guaranteed that .
Update: The time limit has been changed as follows: for test points ~, the time limit is ; for test points ~, the time limit is .
Translated by ChatGPT 5