提交时间:2024-01-27 20:20:45
运行 ID: 38631
#include<bits/stdc++.h> using namespace std; int main() { int a[110][110], m, n, s = 0; cin >> m >> n; for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) { cin >> a[i][j]; } } for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) { if(i == 1 ||i == m || j == 1 || j == n) { s = s + a[i][j]; } } } cout << s; return 0; }