Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
75689 王馨桐 13奇数和与偶数和 C++ Accepted 1 MS 272 KB 223 2024-05-28 19:10:50

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int n,ou=0,ji=0; cin >>n; for(int i=1; i<=n; i++){ if(i%2==0){ ou+=i; } if(i%2==1){ ji+=i; } } cout <<ji <<" "<<ou; return 0; }