Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
138126 何兴驰 13奇数和与偶数和 C++ Compile Error 0 MS 0 KB 198 2025-11-23 12:28:35

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ long long n,s=0,d=0; cin>>n; for(int i=1;i<=n;i++){ if(i%2==0){ sum1+=i; }else{ sum2+=i; } } cout<<s<<" "<<d; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:4: error: 'sum1' was not declared in this scope
    sum1+=i;
    ^
Main.cc:10:4: error: 'sum2' was not declared in this scope
    sum2+=i;
    ^