Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
139452 | 杨博煊 | 矩阵加法 | C++ | 通过 | 100 | 0 MS | 260 KB | 526 | 2024-03-23 17:25:53 |
#include<bits/stdc++.h> using namespace std; int main() { int a[100][100],b[100][100],c[100][100],m,n,lie=0; cin>>n>>m; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ cin>>a[i][j]; } } for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ cin>>b[i][j]; } } for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ c[i][j]=a[i][j]+b[i][j]; } } for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ cout<<c[i][j]<<" "; lie++; if(lie==m){ cout<<endl; lie=0; } } } return 0; }