Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
63753 邓昊源 外围元素之和 C++ Compile Error 0 MS 0 KB 370 2024-01-19 17:43:26

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int a[10][10]; int main(){ int m,n; cin >> m >> n; for(int i = 0;i < m;i++){ for(int j = 0;j < n;j++){ cin >> a[i][j]; } } for(int i = 0;i < m;i++){ for(int j = 0;j < n;j++){ if(i == 0 || j == 0 || i == n-1 || j == m-1){ int sum += a[i][j]; } } } cout << sum; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:15:13: error: expected initializer before '+=' token
     int sum += a[i][j];
             ^
Main.cc:19:10: error: 'sum' was not declared in this scope
  cout << sum;  
          ^