正文
增加 5 行删除 5 行
42 行未改动4344454647484950517 行未改动596061626364656667686970717273747576777881 行未改动42 行未改动$$\begin{bmatrix}a&b\\c&d\end{bmatrix}\begin{bmatrix}x\\y\end{bmatrix}=x\begin{bmatrix}a\\c\end{bmatrix}+y\begin{bmatrix}b\\d\end{bmatrix}=\begin{bmatrix}ax+by\\cx+dy\end{bmatrix}$$矩阵的乘法则可以直接用这个公式表示:若需要求 $C=AB$$$C_{i,j}=\sum^{L}_{k=1}(A_{i,k}\times B_{k,j})$$但是,一般矩阵都是从右往左成的,这点需要注意。如下面的错误。7 行未改动ll x;mint() : x(0) {}mint &operator = (const ll &o) { x = (o % mod + mod) % mod; return *this; }mint &operator = (const mint &o) { x = o.x; return *this; }mint &operator += (const mint &o) { x += o.x; if(x >= mod) x -= mod; return *this; }mint &operator -= (const mint &o) { x -= o.x; if(x < 0) x += mod; return *this; }mint &operator *= (const mint &o) { x *= o.x, x %= mod; return *this;}mint operator + (const mint &o)const { mint res = *this; return res += o; }mint operator - (const mint &o)const { mint res = *this; return res -= o; }mint operator * (const mint &o)const { mint res = *this; return res *= o; }bool operator == (const mint &o)const { return x == o.x; }bool operator != (const mint &o)const { return x != o.x; }bool operator < (const mint &o)const { return x < o.x; }};struct Matrix{81 行未改动42 行未改动4344454647484950517 行未改动596061626364656667686970717273747576777881 行未改动42 行未改动$$\begin{bmatrix}a&b\\c&d\end{bmatrix}\begin{bmatrix}x\\y\end{bmatrix}=x\begin{bmatrix}a\\c\end{bmatrix}+y\begin{bmatrix}b\\d\end{bmatrix}=\begin{bmatrix}ax+by\\cx+dy\end{bmatrix}$$矩阵的乘法则可以直接用这个公式表示:若需要求 $C=AB$$$C_{i,j}=\sum^{L}_{k=1}(A_{i,k}\times B_{k,j})$$但是,一般矩阵都是从右往左成的,这点需要注意。如下面的错误。7 行未改动ll x;mint() : x(0) {}mint &operator = (const ll &o) { x = (o % mod + mod) % mod; return *this; }mint &operator = (const mint &o) { x = o.x; return *this; }mint &operator += (const mint &o) { x += o.x; if(x >= mod) x -= mod; return *this; }mint &operator -= (const mint &o) { x -= o.x; if(x < 0) x += mod; return *this; }mint &operator *= (const mint &o) { x *= o.x, x %= mod; return *this;}mint operator + (const mint &o)const { mint res = *this; return res += o; }mint operator - (const mint &o)const { mint res = *this; return res -= o; }mint operator * (const mint &o)const { mint res = *this; return res *= o; }bool operator == (const mint &o)const { return x == o.x; }bool operator != (const mint &o)const { return x != o.x; }bool operator < (const mint &o)const { return x < o.x; }};struct Matrix{81 行未改动