Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
154856 李懋 12奇数和与偶数和 C++ Compile Error 0 MS 0 KB 397 2026-05-31 10:51:20

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std int main() { int start = min(a, b); int end = max(a, b); long long even_sum = 0; long long odd_sum = 0; for (int i = start; i <= end; ++i) { if (i % 2 == 0) { even_sum += i; } else { odd_sum += i; } } cout << even_sum << " " << odd_sum << endl; return 0; }


Run Info:

Main.cc:3:1: error: expected ';' before 'int'
 int main()
 ^
Main.cc: In function 'int main()':
Main.cc:5:21: error: 'a' was not declared in this scope
     int start = min(a, b);
                     ^
Main.cc:5:24: error: 'b' was not declared in this scope
     int start = min(a, b);
                        ^