#abc208f. F - Cumulative Sum
F - Cumulative Sum
Score : points
问题描述
对于非负整数 和 ,我们使用正整数 定义函数 如下:
$$f(n, m) = \begin{cases} 0 & (n = 0) \\ n^K & (n > 0, m = 0) \\ f(n-1, m) + f(n, m-1) & (n > 0, m > 0) \end{cases} $$给定 、 和 ,求 除以 的余数。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
For non-negative integers and , let us define the function as follows, using a positive integer .
$\displaystyle f(n, m) = \begin{cases} 0 & (n = 0) \\ n^K & (n \gt 0, m = 0) \\ f(n-1, m) + f(n, m-1) & (n \gt 0, m \gt 0) \end{cases}$
Given , , and , find modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print modulo .
Sample Input 1
3 4 2
Sample Output 1
35
When , the values for are as follows.
$m = 0$ | $m = 1$ | $m = 2$ | $m = 3$ | $m = 4$ | |
$n = 0$ | $0$ | $0$ | $0$ | $0$ | $0$ |
$n = 1$ | $1$ | $1$ | $1$ | $1$ | $1$ |
$n = 2$ | $4$ | $5$ | $6$ | $7$ | $8$ |
$n = 3$ | $9$ | $14$ | $20$ | $27$ | $35$ |
0 1 2
Sample Output 2
0
Sample Input 3
1000000000000000000 30 123456
Sample Output 3
297085514
update @ 2024/3/10 09:22:16