-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCPP0259.cpp
More file actions
43 lines (42 loc) · 1.02 KB
/
CPP0259.cpp
File metadata and controls
43 lines (42 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <bits/stdc++.h>
#define MAX 10000001
#define ll long long
#define fastsync() \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
const int mod = 1e9 + 7;
using namespace std;
int main() {
fastsync();
int n, m, p;
cin >> n >> m >> p;
int a[n][m], b[m][p];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> a[i][j];
}
}
for (int i = 0; i < m; i++) {
for (int j = 0; j < p; j++) {
cin >> b[i][j];
}
}
int c[n][p];
for (int i = 0; i < n; i++) {
for (int j = 0; j < p; j++) {
int tmp = 0;
for (int k = 0; k < m; k++) {
tmp += a[i][k] * b[k][j];
}
c[i][j] = tmp;
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < p; j++) {
cout << c[i][j] << ' ';
}
cout << endl;
}
return 0;
}