#include <bits/stdc++.h>
using namespace std;
ostream &sp(ostream &output);
int main ()
{
int x;
while(scanf("%d",&x) != EOF)
{
int a[2][3]{0},b[3][2]{0},c[2][2]{0};
a[0][0] = x;
for(int i = 0; i < 2; ++i)
{
for(int j = 0; j < 3; ++j)
{
if(i==0&&j==0)
continue;
else
scanf("%d",&a[i][j]);
}
}
for(int i = 0; i < 3; ++i)
{
for(int j = 0; j < 2; ++j)
{
scanf("%d",&b[i][j]);
}
}
for(int i = 0; i < 2; ++i)
{
for(int j = 0; j < 2; ++j)
{
for(int k = 0; k < 3; ++k)
{
c[i][j] += a[i][k] * b[k][j];
}
}
}
for(int i = 0; i < 2; ++i)
{
for(int j = 0; j < 2; ++j)
{
if(j == 0)
cout<<c[i][j];
else
cout<<sp<<c[i][j];
}
cout<<endl;
}
}
return 0;
}
//空格
ostream &sp(ostream &output)
{
return output << " ";
}
codeup 问题 F: 计算两个矩阵的乘积
最新推荐文章于 2024-11-07 23:24:07 发布