HDU 5015 233Matrix (构造矩阵)】的更多相关文章

233 Matrix Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1399    Accepted Submission(s): 826 Problem Description In our daily life we often use 233 to express our feelings. Actually, we may…
题意:给出矩阵的第0行(233,2333,23333,...)和第0列a1,a2,...an(n<=10,m<=10^9),给出式子: A[i][j] = A[i-1][j] + A[i][j-1],要求A[n][m]. 解法:看到n<=10和m<=10^9 应该对矩阵有些想法,现在我们假设要求A[a][b],则A[a][b] = A[a][b-1] + A[a-1][b] = A[a][b-1] + A[a-1][b-1] + A[a-2][b] = ... 这样相当于右图:,红…
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...…
http://acm.hdu.edu.cn/showproblem.php?pid=5015 由于是个二维的递推式,当时没有想到能够这样构造矩阵.从列上看,当前这一列都是由前一列递推得到.依据这一点来构造矩阵.令b[i]代表第i列,是一个(n+2)*1的矩阵,即b[1] = [1,233......],之所以在加了两行,是要从前一个矩阵b[i-1]得到b[i]中的第二个数2333...,再构造一个转换矩阵a,它是一个(n+2)*(n+2)的矩阵,那么a^(m-1) * b就是第m列. /* a矩…
http://acm.hdu.edu.cn/showproblem.php?pid=5015 需要构造一个 n+2 维的矩阵. 就是要增加一维去维护2333这样的序列. 可以发现 2333 = 233*10 + 3 所以增加了一维就 是1, 然后就可以全部转移了. 10 0 0 0 0 ... 1                                                                                                   1…
Another kind of Fibonacci Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1219    Accepted Submission(s): 466 Problem Description As we all known , the Fibonacci series : F(0) = 1, F(1) = 1, F(N…
任意门:http://acm.hdu.edu.cn/showproblem.php?pid=1757 A Simple Math Problem Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6621    Accepted Submission(s): 4071 Problem Description Lele now is thin…
HDU 5667 构造矩阵快速幂 题目描述 解析 我们根据递推公式 设 则可得到Q的指数关系式 求Q构造矩阵 同时有公式 其中φ为欧拉函数,且当p为质数时有 代码 #include <cstdio> using namespace std; long long pow_mod(long long a, long long p, long long mod) { if (p == 0) return 1; long long ans = pow_mod(a, p / 2, mod); ans =…
Number Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 147964    Accepted Submission(s): 35964 Problem Description A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A…
转载:http://blog.csdn.net/wdcjdtc/article/details/39318847 之前各种犯傻 推了好久这个东西.. 后来灵关一闪  就搞定了.. 矩阵的题目,就是构造矩阵比较难想! 题意:给出一个矩阵的第一列和第一行(下标从0开始),(0,0)位置为0, 第一行为,233,2333,23333...一次加个3, 第一列为输入的n个数. 然后从(1,1)位置开始,等于上面的数加左边的数,问(n+1,m+1)的数是多少,也就是右下角的数 思路: 把矩阵画出来: |…