
矩阵快速幂
Error Man
我是菜逼
展开
-
洛谷 P3390 (矩阵快速幂模版)
题目背景 矩阵快速幂 题目描述 给定n*n的矩阵A,求A^k 输入输出格式 输入格式: 第一行,n,k 第2至n+1行,每行n个数,第i+1行第j个数表示矩阵第i行第j列的元素 输出格式: 输出A^k 共n行,每行n个数,第i行第j个数表示矩阵第i行第j列的元素,每个元素模10^9+7 输入输出样例 输入样例#1:复制 2 1 1 1 1 1 ...原创 2018-10-09 20:27:44 · 264 阅读 · 0 评论 -
HDU - 5950 Recursive sequence (构造矩阵 + 矩阵快速幂)
Recursive sequence Farmer John likes to play mathematics games with his N cows. Recently, they are attracted by recursive sequences. In each turn, the cows would stand in a line, while John writes tw...原创 2018-10-09 23:03:41 · 256 阅读 · 1 评论 -
Codeforces 1182 E. Product Oriented Recurrence(矩阵快速幂 + 欧拉降幂 + 快速幂)
E. Product Oriented Recurrence Letfx=c2x−6⋅fx−1⋅fx−2⋅fx−3fx=c2x−6⋅fx−1⋅fx−2⋅fx−3forx≥4x≥4. You have given integersnn,f1f1,f2f2,f3f3, andcc. Findfnmod(109+7)fnmod(109+7). Input The only li...原创 2019-07-23 20:20:23 · 633 阅读 · 0 评论 -
codeforces 227 C Flying Saucer Segments ,E Anniversary (矩阵快速幂)
目录 C.Flying Saucer Segments E.Anniversary C.Flying Saucer Segments An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have an...原创 2019-08-04 22:14:55 · 256 阅读 · 1 评论 -
2019 牛客多校 第五场 B.generator 1(十进制矩阵快速幂)
generator 1 题目描述 You are given four positive integersx_0, x_1, a, bx0,x1,a,b. And you knowx_i = a \cdot x_{i-1} + b \cdot x_{i-2}xi=a⋅xi−1+b⋅xi−2for alli \ge 2i≥2. Given two positive integ...原创 2019-08-01 21:59:43 · 310 阅读 · 0 评论