- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemp.cpp
More file actions
Latest commit
33 lines (27 loc) · 618 Bytes
/
Copy pathtemp.cpp
File metadata and controls
33 lines (27 loc) · 618 Bytes
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
#include<iostream>
usingnamespacestd;
intmain() {
int r, c; cin >> r >> c;
int a[r][c], b[r][c];
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) cin >> a[i][j];
}
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) cin >> b[i][j];
}
int ans[r][c];
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) ans[i][j] = 0;
}
for (int i = 0; i < r; i++) {
for (int j = 0; j < r; j++) {
for (int l = 0; l < c; l++) {
ans[i][j] += (a[i][l] * b[l][j]);
}
}
}
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) cout << ans[i][j] << '';
cout << endl;
}
}