80分求助qwq

B2101 计算矩阵边缘元素之和

```cpp #include<bits/stdc++.h> using namespace std; int n, m, ans, a[105][105]; int main() { cin>>n>>m; for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) { int x; cin>>x; if(!i || !j || i == n - 1 || j == m - 1) ans += x; } cout<<ans; return 0; } ```
by tder @ 2023-09-22 22:29:01


@[liyirong567](/user/955954)
by tder @ 2023-09-22 22:31:49


@[tder](/user/714254) 呃呃请教一下,她代码到底哪里错了
by Lele_S @ 2023-09-22 22:47:35


@[Lele_S](/user/757702) $1\times1$ 的矩阵会重复计算
by tder @ 2023-09-22 22:52:38


@[tder](/user/714254) 哦谢谢
by Lele_S @ 2023-09-22 22:54:06


@[Lele_S](/user/757702) qwq
by tder @ 2023-09-22 23:02:07


|