#include<bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for(int i=(l);i<=(r);i++)
#define per(i,l,r) for(int i=(l);i>=(r);i--)
#define ll long long
#define pii pair<int, int>
#define mset(s,t) memset(s,t,sizeof(t))
#define mcpy(s,t) memcpy(s,t,sizeof(t))
#define fir first
#define pb push_back
#define sec second
inline int read () {
int x = 0, f = 0;
char ch = getchar();
while (!isdigit(ch)) f |= (ch=='-'),ch= getchar();
while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
return f?-x:x;
}
template<typename T> void print(T x) {
if (x < 0) putchar('-'), x = -x;
if (x >= 10) print(x/10);
putchar(x % 10 + '0');
}
const int N = 1e2 + 10;
const int mod = 1e9 + 7;
ll n, k;
struct Matrix {
ll c[N][N];
Matrix () {
for (int i = 1; i <= n; i ++) {
for (int j = 1; j <&#
矩阵快速幂(板子)
本文介绍矩阵快速幂的原理与实现,强调在重载乘法运算符时要考虑矩阵乘法的非交换性,确保计算正确。
摘要由CSDN通过智能技术生成