![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
矩阵快速幂
lzk_1049668876
stay hungry stay foolish
展开
-
【Codeforces Gym - 101635C Macarons 】【矩阵快速幂+状压】【dfs时间换空间】
【链接】 http://codeforces.com/gym/101635/attachments 【题意】 求用1*1,1*2的方格填n*m的矩阵的方法数 【知识点】 状压dfs+矩阵快速幂 【分析】 每列状态的状态转移压缩,通过dfs状压求出每个状态的邻接矩阵,求出初始矩阵,再快速幂即可 【代码】 #include<stdio.h> #include<...原创 2018-08-24 10:33:25 · 399 阅读 · 0 评论 -
【hdu4549 M斐波那契数列】【矩阵快速幂】【F[n] = F[n-1] * F[n-2] ,求F[n] 】
【链接】 http://acm.hdu.edu.cn/showproblem.php?pid=4549 【题意】 F[0] = a F[1] = b F[n] = F[n-1] * F[n-2] ( n > 1 ) 给出a, b, n,求出F[n] 【分析】 写出几项后,发现:F[n]=a^x*b^y,x,y成斐波那契数列。 且有规律:ans=a^(F[n-1])*b^(F[n]...原创 2018-10-04 15:23:24 · 909 阅读 · 0 评论