Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
77007 刘世杰 外围元素之和 C++ Compile Error 0 MS 0 KB 343 2024-06-08 09:18:03

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main() { int m,n,a[101][101],w=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 || j == 1 || i == m || j == n) num+=a[i][j]; } } cout << num; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:14:45: error: 'num' was not declared in this scope
    if(i == 1 || j == 1 || i == m || j == n) num+=a[i][j];
                                             ^
Main.cc:17:10: error: 'num' was not declared in this scope
  cout << num;
          ^
Main.cc:5:21: warning: unused variable 'w' [-Wunused-variable]
 int m,n,a[101][101],w=0;
                     ^