
矩阵连乘
文章平均质量分 77
Werky_blog
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
斐波那契数列推导及应用
首先:等价于 ..................(1)等价于..................(2)然后:由(1)(2)递推得 ........................(3) ........................(4)其中A,B为常数,由确定最后:由(3)(4)解二元一次方程组得:其中C,D为常数,原创 2017-07-27 18:13:17 · 2250 阅读 · 0 评论 -
VOJ 1049 经典题目4 矩阵置换
题目:https://vijos.org/p/1049给出n,m,k:一个序列n个数,m行置换操作,要执行k次操作。求结果序列。把m次操作算出来,作为结果再执行k/m的次方次,相当于把m次操作合并了。再把余数的操作算出来即可,注意move在a矩阵前面#include#define ll intusing namespace std;const int maxn=10原创 2017-11-12 17:39:17 · 414 阅读 · 0 评论 -
hdu 2157 (矩阵快速幂)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=2157通过将矩阵连乘的过程模拟出来,模拟一遍就懂了。#includeusing namespace std;typedef long long int ll;const ll mod = 1000;const int maxn=22; //自己看情况定义//定义矩阵乘法struct原创 2017-11-05 20:31:30 · 669 阅读 · 0 评论 -
POJ 3070 矩阵经典6 最基础的Fibonacci递推
#include#includeusing namespace std;typedef long long int ll;const ll mod = 10000;const int maxn=3;struct matrix{ ll arr[maxn][maxn]; matrix operator*(matrix b){ matrix ans;原创 2017-11-14 13:47:22 · 170 阅读 · 0 评论 -
hdu 5950 Recursive sequence(递推 快速幂矩阵)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=5950参考自:http://blog.youkuaiyun.com/spring371327/article/details/52973534#includeusing namespace std;typedef long long int ll;const ll mod = 214749364原创 2017-11-04 21:34:21 · 319 阅读 · 0 评论 -
voj 1067 经典矩阵7 递推+矩阵快速幂
题目:https://vijos.org/p/1067#includeusing namespace std;typedef long long int ll;const ll mod = 7777777;const int maxn=11;struct matrix{ ll arr[maxn][maxn]; matrix operator*(ma原创 2017-11-13 21:17:30 · 568 阅读 · 0 评论 -
hdu 3411 Snail Alice (等比数列递推)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=3411是一个等比数列,这个已经忘干净了,转:http://blog.youkuaiyun.com/wust_xhj/article/details/47779539其实最好的方法还是猜:q=2:1,1,3,5,11,21,43,85,171……,很容易看出f[n] = f[n-1] + 2*f[n-2]。转载 2017-11-14 21:18:46 · 309 阅读 · 0 评论 -
POJ 3233 Matrix Power Series(二分 / 矩阵套矩阵)
题目:http://poj.org/problem?id=3233计算那个公式即可。1.二分 偶数:matrix b=solve(a,k/2);return quick_pow(a,k/2)+1)+b;奇数:matrix b=solve(a,k/2);return quick_pow(a,k)+quick_pow(a,(k-1)/2)*b+b;2.矩阵套矩阵:比原创 2017-11-06 14:40:47 · 309 阅读 · 0 评论