Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
40447 | lnx | 计算矩阵边缘元素之和 | C++ | 通过 | 0 MS | 248 KB | 288 | 2024-02-10 16:53:26 |
#include<iostream> using namespace std; int main() { int m,n,s=0,t=0; cin>>m>>n; int a[m][n]; for(int i=0;i<m;i++){ for(int j=0;j<n;j++){ cin>>a[i][j]; s+=a[i][j]; } } for(int i=1;i<m-1;i++){ for(int j=1;j<n-1;j++){ t+=a[i][j]; } } cout<<s-t; }