ACM-矩阵快速幂
矩阵快速幂
luyehao1
ACMer
展开
-
Funny Function(HDU 6050)
Function Fx,ysatisfies:For given integers N and M,calculate Fm,1 modulo 1e9+7.There is one integer T in the first line.The next T lines,each line includes two integers N and M .1<=T<=10000,1<=N,M<2^63.原创 2017-07-29 18:50:12 · 381 阅读 · 0 评论 -
Matrix Power Series(构造矩阵+矩阵快速幂)
Matrix Power Series Time Limit : 6000/3000ms (Java/Other) Memory Limit : 262144/131072K (Java/Other)Problem Description Given a n × n matrix A and a positive integer k, find the sum S = A + A2 + A3 ...原创 2018-05-27 17:14:12 · 2415 阅读 · 0 评论 -
Mistwald(矩阵快速幂解类似图论问题)
Mistwald Time Limit : 4000/2000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other)Problem Description In chapter 4 of the game Trails in the Sky SC, Estelle Bright and her friends ...原创 2018-05-29 16:01:33 · 461 阅读 · 0 评论 -
Sequence(hdu 6395 二分+矩阵快速幂)
题目:Sequence题意:已知一个递推式,求递推式第n项。思路:在表达式中,如果 为一个固定常数E,那么这个表达式就可以用矩阵快速幂进行求解。矩阵构造为: * ()^num因此,枚举E的值即可(O(sqrt(P))),每次枚举到的 i 都是的值第一次出现的位置,二分找到其最后一次出现的位置j,在这段区间内E就是一个常数,使用上述矩阵快速幂即可。总时间复杂度:O(sqrt(P)...原创 2018-08-14 11:38:19 · 218 阅读 · 0 评论 -
Count(hdu 6470 矩阵快速幂 含关于n的多项式)
题目链接:hdu 6470 Count题意:f[n] = 2*f[n-2] + f[n-1] + n^3,n<=1e18,求f[n] 。思路:在计算 f[n+1] 的时候, 要变为,所以构造的矩阵中需要有这几项,然后因为引入了,所以要变为,因为项、项、常数项都已经存在,所以不需要引入新的项,其余各项均可通过这几项计算出。因此,构造的矩阵为:...原创 2019-03-17 21:49:25 · 645 阅读 · 0 评论