int n, m;
int k;
struct matrix{
int c[101][101];
matrix(){memset(c,0,sizeof c);}
};
matrix operator*(matrix &a,matrix &b){
matrix t;
for(int i=1;i<=n;i++){
for(int j=1;j<=k;j++){
for(int g=1;g<=m;g++){
t.c[i][j]+=a.c[i][g]*b.c[g][j];
}
}
}
return t;
}
void solve(){
cin>>n>>m>>k;
matrix a,b;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>a.c[i][j];
}
}
for(int i=1;i<=m;i++){
for(int j=1;j<=k;j++){
cin>>b.c[i][j];
}
}
matrix ans=a*b;
for(int i=1;i<=n;i++){
for(int j=1;j<=k;j++){
cout<<ans.c[i][j]<<" ";
}
cout<<endl;
}
}
标签:matrix,int,memset,矩阵,101,乘法
From: https://www.cnblogs.com/mathiter/p/18088284