Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
22001 | 周燚 | 矩阵乘法 | C++ | Accepted | 9 MS | 844 KB | 566 | 2022-02-08 11:03:49 |
#include<bits/stdc++.h> using namespace std; int main(){ int n,m,k,a[105][105],b[105][105],c[105][105]; cin>>n>>m>>k; for(int i=1;i<=n;++i){ for(int j=1;j<=m;++j){ cin>>a[i][j]; } } for(int i=1;i<=m;++i){ for(int j=1;j<=k;++j){ cin>>b[i][j]; } } for(int i=1;i<=n;++i){ for(int j=1;j<=k;++j){ c[i][j]=0; for(int l=1;l<=m;l++){ c[i][j]+=a[i][l]*b[l][j]; } } } for(int i=1;i<=n;++i){ for(int j=1;j<=k;++j){ cout<<c[i][j]<<" "; } cout<<endl; } return 0; }