为什么只有20分,求助!!!

B2101 计算矩阵边缘元素之和

前面是 $0\sim n-1$ 和 $0\sim m-1$,后面又变成了 $1\sim n$ 和 $1\sim m$
by tder @ 2023-11-05 11:54:49


@[tlljh120](/user/1056503)
by tder @ 2023-11-05 11:55:27


谢谢大佬
by tlljh120 @ 2023-11-05 12:04:22


------------ ------------ ------------ ------------ ------------ ------------ ------------ ------------ ###### ------------ ###### ------------ _~~****- 1. ``` #include<iostream> #include<cstdio> #include<cmath> using namespace std; int m,n,he=0,x; int main(){ cin>>m>>n; for(int i=0;i<m;i++){ for(int j=0;j<n;j++){ cin>>x; if(i==0 || i==m-1 || j==0 || j==n-1){ he+=x; } } } cout<<he; return 0; } ``` ****~~_
by xujinling @ 2023-11-16 19:58:55


|