标签:lin operator ring main using pid 传送门 opera problem
\(\begin{aligned}a_i*b_i&=(a_{i-1}*ax+ay)*(b_{i-1}*bx+by)\\&=a_{i-1}*ax*b_{i-1}*bx+a_{i-1}*ax*by+b_{i-1}*bx*ay+ay*by\end{aligned}\)
\(init=\begin{bmatrix}s_i\\a_{i-1}*b_{i-1}\\a_{i-1}\\b_{i-1}\\1\end{bmatrix}\)
\(acc=\begin{bmatrix}&1,&ax*bx,&ax*by,&bx*ay,&ay*by\\&0,&ax*bx,&ax*by,&bx*ay,&ay*by\\&0,&0,&ax,&0,&ay\\&0,&0,&0,&bx,&by\\&0,&0,&0,&0,&1\end{bmatrix}\)
#include<iostream>
#include<cstring>
using namespace std;
long long n;
long long a,b;
const long long mod=2147493647;
struct node
{
long long n,m;
long long a[15][15];
node operator * (const node &b)
{
node c;
c.n=n;
c.m=b.m;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=b.m;j++)
{
c.a[i][j]=0;
for(int k=1;k<=m;k++)
{
c.a[i][j]=(c.a[i][j]+a[i][k]*b.a[k][j]%mod)%mod;
}
}
}
return c;
}
};
node qkpow(node a,long long b)
{
if(b==1)
return a;
node t=qkpow(a,b/2);
t=t*t;
if(b%2==1)
t=t*a;
return t;
}
node init;
node acc;
void c_in()
{
cin>>n>>a>>b;
}
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
c_in();
return 0;
}
标签:lin operator ring main using pid 传送门 opera problem
原文地址:https://www.cnblogs.com/loney-s/p/12121607.html