矩阵快速幂
Viko_ReCode
这个作者很懒,什么都没留下…
展开
-
POJ 3070 Fibonacci (矩阵快速幂基础题)
题目链接:http://poj.org/problem?id=3070 创建如下矩阵求解递推式Fn项的值: 代码如下: #include #include const int mod = 10000; const int matSize = 2; struct Mat { int val[matSize][matSize]; void init原创 2013-09-11 22:50:43 · 571 阅读 · 0 评论 -
Light OJ 1096 nth Term (矩阵快速幂)
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1096 递推矩阵如下: 代码如下: #include #include const int mod = 10007; const int matSize = 5; int n, a, b, c; struct Mat { int原创 2013-09-13 17:38:31 · 559 阅读 · 0 评论 -
HDU 4686 Arc of Dream (矩阵快速幂)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4686 根据题意可得: 递推矩阵如下: 代码如下: #include #include const int mod = 1000000007; const int matSize = 5; long long n, a0, ax, ay, b0,原创 2013-09-13 10:22:38 · 411 阅读 · 0 评论