Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
103890 | 小徐老师 | 外围元素之和 | C++ | Accepted | 1 MS | 272 KB | 524 | 2024-12-31 20:18:49 |
#include <bits/stdc++.h> using namespace std; int main() { int m, n; 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]; } } //i = 0 int s = 0; for(int i = 0; i < m; ++i) { for(int j = 0; j < n; ++j) { if(i == 0 || i == m - 1 || j == 0 || j == n - 1) s = s + a[i][j]; } } cout << s << '\n'; return 0; }