233 MatrixTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 3402 Accepted Submission(s): 1903 Problem Description 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 = 233,a0,2 = 2333,a0,3 = 23333...) Besides, in 233 matrix, we got ai,j = ai-1,j +ai,j-1( i,j ≠ 0). Now you have known a1,0,a2,0,...,an,0, could you tell me an,m in the 233 matrix? Input There are multiple test cases. Please process till EOF. Output For each case, output an,m mod 10000007. Sample Input
1 1 1 2 2 0 0 3 7 23 47 16
扫描二维码关注公众号,回复:
2816747 查看本文章
Sample Output
234 2799 72937 Hint Source 2014 ACM/ICPC Asia Regional Xi'an Online Recommend hujie 这个题需要构建一个矩阵a:(大小是(n+2)*(n+2))(比如n=5) 10 0 0 0 0 0 1 10 1 0 0 0 0 1 10 1 1 0 0 0 1 10 1 1 1 0 0 1 10 1 1 1 1 0 1 10 1 1 1 1 1 1 0 0 0 0 0 0 1 然后a的(m-1)次幂与矩阵b相乘得矩阵c; 矩阵b大小为((n+1)*1);(比如n=5) 233 233+b[1][0] 233+b[1][0]+b[2][0] 233+b[1][0]+b[2][0]+b[3][0] 233+b[1][0]+b[2][0]+b[3][0]+b[4][0] 233+b[1][0]+b[2][0]+b[3][0]+b[4][0]+b[5][0] 3 得到的结果矩阵的c[n][0]就是所求的值 |
HDU - 5015 Matrix(矩阵快速幂)
猜你喜欢
转载自blog.csdn.net/weixin_42754600/article/details/81556861
今日推荐
周排行