题目:https://www.lydsy.com/JudgeOnline/problem.php?id=3231 矩阵乘法裸题. 1018是10^18.别忘了开long long. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #define ll long long using namespace std; ; int n; ll L,R,b[N],c[N…
矩阵乘法裸题..差分一下然后用矩阵乘法+快速幂就可以了. --------------------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int maxn = 20; typedef long long ll; t…
今天真是莫名石乐志 一眼矩阵乘法,但是这个矩阵的建立还是挺有意思的,就是把sum再开一列,建成大概这样 然后记!得!开!long!long!! #include<iostream> #include<cstdio> using namespace std; const int N=20; long long n,b[N],c[N],sum,l,r,mod; struct jz { long long a[N][N]; jz operator * (const jz &b)…
还好$QwQ$ 思路:矩阵快速幂 提交:1次 题解: 如图: 注意$n,m$如果小于$k$就不要快速幂了,直接算就行... #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #define ull unsigned long long #define ll long long #define R register ll using namespace std;…
题解: 矩阵乘法,在矩阵中构造当前前缀和: 注意:for(int/long long ;;); #include<iostream> #include<cstdio> #include<cstring> using namespace std; typedef long long Lint; Lint n,m; int k,p; int b[200]; int c[200]; Lint tmp1,tmp2; Lint sum; int minit(){ tmp1=tmp…