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

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std int main() { int main() { int a, b; if (!(cin >> a >> b)) { return 0; } 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:16: error: a function-definition is not allowed here before '{' token
     int main() {
                ^
Main.cc:24:1: error: expected '}' at end of input
 }
 ^