-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy path0069.cpp
More file actions
31 lines (29 loc) · 696 Bytes
/
0069.cpp
File metadata and controls
31 lines (29 loc) · 696 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
// 0069.矩阵乘法
#include <iostream>
using namespace std;
int main()
{
int x, y, z;
while(cin >> x >> y >> z)
{
int a[x][y], b[y][z];
for(int i = 0; i < x; i++)
for(int j = 0; j < y; j++)
cin >> a[i][j];
for(int i = 0; i < y; i++)
for(int j = 0; j < z; j++)
cin >> b[i][j];
for(int i = 0; i < x; i++)
{
for(int j = 0; j < z; j++)
{
int tmp = 0;
for(int k = 0; k < y; k++)
tmp += a[i][k]*b[k][j];
cout << tmp << ' ';
}
cout << endl;
}
}
return 0;
}