数论知识:
模运算
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//模运算
ll mul(ll a, ll b, ll m) {
a = a % m;
b = b % m;
ll res = 0;
while (b > 0) {
if (b & 1) res = (res + a) % m; // 判断奇偶数
a = (a + a) % m;// 2 4 8 16 32
b >>= 1;
}
return res;
}
//快速幂运算
int fastPow(int a, int n) {
int ans = 1;
while (n) {
if (n & 1) ans *= a;
a *= a;
n >>= 1;
}
return ans;
}
ll fastpow(int a, int n, int m) {
int ans = 1;
while (n) {
if (n & 1) ans = (ans * a )% m;
a *= a;
n >>= 1;
}
return ans;
}
const int m = 1000007;
// 矩阵的快速幂
struct matrix{ int m[100][100]; };
matrix operator *(const matrix& a, const matrix& b) { // 重载*为矩阵乘法,注意const
matrix c;
memset(c.m,0, sizeof(c.m));
for (int i = 0; i < 100; i++) {
for (int j = 0; j < 100; j++) {
for (int k = 0; k < 100; k++) {
c.m[i][j] = (c.m[i][k] + a.m[i][k] * b.m[k][j]) % m;
}
}
}
return c;
}
matrix pow_matrix(matrix a, int n) {
matrix ans;
memset(ans.m, 0, sizeof(ans.m));
for (int i = 0; i < 100; i++) ans.m[i][i] = 1;
while (n) {
if (n & 1) ans = ans * a;
a = a * a;
n >>= 1;
}
return ans;
}
int main() {
int n, u,m;
cin >> n >> m >> u;
int a[100][100], b[100][100], c[100][100];
//A[i][k]*B[k][j] = S[i][j]
// 矩阵运算
for (int i = 1; i <= m; i++) { // 行
for (int j = 1; j <= u; j++) { // 列
for (int k = 1; k <= n; k++) { // 一行有多少元素
c[i][j] += a[i][k] * b[k][j];
}
}
}
return 0;
}