#P10503. 233 Matrix

233 Matrix

题目描述

In our daily life we often use 233 to express our feelings. Actually, we may say 2333, 23333, or 233333 ... in the same meaning. And here is the question: Suppose we have a matrix called 233 matrix. In the first line, it would be 233, 2333, 23333... (it means a0,1=233a _ {0,1} = 233, a0,2=2333a_{0,2} = 2333, a0,3=23333a_{0,3} = 23333...) Besides, in 233 matrix, we got ai,j=ai1,j+ai,j1(i,j0)a_{i,j} = a_{i-1,j} +a_{i,j-1}( i,j \neq 0). Now you have known a1,0,a2,0,,an,0a_{1,0},a_{2,0},\dots,a_{n,0}, could you tell me an,ma_{n,m} in the 233 matrix?

输入格式

There are multiple test cases. Please process till EOF.

For each case, the first line contains two postive integers n,m(n10,m109)n,m(n \le 10,m \le 10^9). The second line contains n integers, a1,0,a2,0,...,an,0a_{1,0},a_{2,0},...,a_{n,0} (0ai,0<2310 \le a_i,0 < 2^{31}).

输出格式

For each case, output an,ma_{n,m} mod 10000007.

题目大意

【题目描述】

在我们的日常生活中,我们经常用 233 来表达我们的情感。实际上,我们可能会说 2333、23333 或者 233333... 都表示同样的意思。现在有一个问题:假设我们有一个称为 233 矩阵。在第一行,它可能是 233、2333、23333...(表示 a0,1=233a _ {0,1} = 233a0,2=2333a_{0,2} = 2333a0,3=23333a_{0,3} = 23333...)。此外,在 233 矩阵中,我们有 ai,j=ai1,j+ai,j1(i,j0)a_{i,j} = a_{i-1,j} +a_{i,j-1}( i,j \neq 0)。现在已知 a1,0,a2,0,,an,0a_{1,0},a_{2,0},\dots,a_{n,0},你能告诉我 233 矩阵中的 an,ma_{n,m} 吗?

【输入格式】

有多个测试用例,请处理直到 EOF。

对于每个案例,第一行包含两个正整数 n,m(n10,m109)n,m(n \le 10,m \le 10^9)。第二行包含 n 个整数,a1,0,a2,0,...,an,0a_{1,0},a_{2,0},...,a_{n,0}0ai,0<2310 \le a_i,0 < 2^{31})。

【输出格式】

对于每个案例,输出 an,ma_{n,m} 模 10000007。

翻译来自于:ChatGPT

1 1
1
2 2
0 0
3 7
23 47 16
234
2799
72937

提示