// 10'42"
#include <iostream>
using namespace std;
const int N = 110;
int arr[N][N];
int brr[N][N];
int crr[N][N];
int main()
{
int x1, y1;
cin >> x1 >> y1;
for(int i = 1; i <= x1; ++ i)
for(int j = 1; j <= y1; ++ j)
cin >> arr[i][j];
int x2, y2;
cin >> x2 >> y2;
if(y1 != x2)
{
cout << "Error: "<< y1 << " != " << x2 << endl;
return 0;
}
for(int i = 1; i <= x2; ++ i)
for(int j = 1; j <= y2; ++ j)
cin >> brr[i][j];
int x3 = x1, y3 = y2;
for(int i = 1; i <= x3; ++ i)
for(int j = 1; j <= y3; ++ j)
for(int k = 1; k <= x2; ++ k)
crr[i][j] += arr[i][k] * brr[k][j];
cout << x3 << " " << y3 << endl;
for(int i = 1; i <= x3; ++ i)
{
for(int j = 1; j <= y3; ++ j)
{
cout << crr[i][j];
if(j != y3) cout << " ";
}
if(i != x3) cout << endl;
}
return 0;
}
标签:arr,x1,15,int,L1,x2,048,y1,y2
From: https://www.cnblogs.com/Frodnx/p/18344194