Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
40437 | chenyanda | 矩阵加法 | C++ | 通过 | 1 MS | 252 KB | 391 | 2024-02-10 15:43:49 |
#include<iostream> using namespace std; int main() { int m,n; cin>>m>>n; int a[m][n],b[m][n],c[m][n]; for(int i=0;i<m;i++){ for(int j=0;j<n;j++){ cin>>a[i][j]; } } for(int i=0;i<m;i++){ for(int j=0;j<n;j++){ cin>>b[i][j]; } } for(int i=0;i<m;i++){ for(int j=0;j<n;j++){ c[i][j]=a[i][j]+b[i][j]; cout<<c[i][j]<<" "; } cout<<endl; } }