Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
154480 蔡皓霆 12奇数和与偶数和 C++ Compile Error 0 MS 0 KB 448 2026-05-30 14:23:13

Tests(0/0):


Code:

#include <iostream> using namespace std; int main() { int n, m; cin >> n >> m; for(int i=m;i<=;i++) int even_sum = 0; // 偶数和 int odd_sum = 0; // 奇数和 // 遍历区间 [m, n] for (int i = m; i <= n; i++) { if (i%2==0) { es+= i; } else { os += i; } } cout <<es<< " " <<os<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:20: error: expected primary-expression before ';' token
     for(int i=m;i<=;i++)
                    ^
Main.cc:9:9: warning: unused variable 'even_sum' [-Wunused-variable]
     int even_sum = 0;  // 偶数和
         ^
Main.cc:17:14: error: 'es' was not declared in this scope
              es+= i;
              ^
Main.cc:21:14: error: 'os' was not declared in this scope
              os += i;
              ^
Main.cc:25:12: error: 'es' was not declared in this scope
     cout <