Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
4128 李伟和 [在线测评解答教程] 闰年 C++ Compile Error 0 MS 0 KB 467 2024-08-04 01:24:32

Tests(0/0):


Code:

#include <iostream> using namespace std; int main() { int t, n; cin >> t; int years[MAX_YEARS]; for (int i = 0; i < t; i++) { cin >> years[i]; } for (int i = 0; i < t; i++) { if ((years[i] % 400 == 0) || (years[i] % 4 == 0 && years[i] % 100 != 0)) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:6:15: error: 'MAX_YEARS' was not declared in this scope
     int years[MAX_YEARS];  
               ^
Main.cc:8:16: error: 'years' was not declared in this scope
         cin >> years[i];  
                ^
Main.cc:11:14: error: 'years' was not declared in this scope
         if ((years[i] % 400 == 0) || (years[i] % 4 == 0 && years[i] % 100 != 0)) {  
              ^
Main.cc:4:12: warning: unused variable 'n' [-Wunused-variable]
     int t, n;  
            ^