mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-09 22:58:48 +00:00
parent
d530e59734
commit
8244370d9c
68
LibreOJ/100/100.cpp
Normal file
68
LibreOJ/100/100.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 1005,
|
||||
mod = 1e9 + 7;
|
||||
|
||||
int n, m, p;
|
||||
|
||||
class Matrix {
|
||||
private:
|
||||
int data[N][N];
|
||||
|
||||
public:
|
||||
Matrix() {
|
||||
memset(data, 0x00, sizeof(data));
|
||||
}
|
||||
|
||||
int* operator[](int i) {
|
||||
return data[i];
|
||||
}
|
||||
|
||||
Matrix operator*(Matrix b) const {
|
||||
Matrix c;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
for (int j = 1; j <= p; j++) {
|
||||
for (int k = 1; k <= m; k++) {
|
||||
c[i][j] = (c[i][j] + 1ll * data[i][k] * b[k][j] % mod) % mod;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
} a, b, c;
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
|
||||
cin >> n >> m >> p;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
for (int j = 1; j <= m; j++) {
|
||||
cin >> a[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i <= m; i++) {
|
||||
for (int j = 1; j <= p; j++) {
|
||||
cin >> b[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
c = a * b;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
for (int j = 1; j <= p; j++) {
|
||||
cout << (c[i][j] % mod + mod) % mod << ' ';
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
BIN
LibreOJ/100/data/0.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/0.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/0.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/0.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/1.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/1.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/2.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/2.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/3.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/3.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/4.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/4.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/5.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/5.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/6.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/6.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/7.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/7.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/8.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/8.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/9.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/100/data/9.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/100/data/9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user