Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
45087 | teacher_lu | 计算矩阵边缘元素之和 | C++ | Accepted | 0 MS | 248 KB | 345 | 2024-04-09 20:00:14 |
#include <bits/stdc++.h> using namespace std; int main(){ int m,n; cin>>m>>n; int a[m+1][n+1]; int s=0; for(int i=1;i<=m;i++){ for(int j=1;j<=n;j++){ cin>>a[i][j]; if(i==1) s+=a[i][j]; else if(i==m) s+=a[i][j]; else if(j==1) s+=a[i][j]; else if(j==n) s+=a[i][j]; } } cout<<s; return 0; }