Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
162387 李嘉峻 13奇数和与偶数和 C++ Accepted 1 MS 272 KB 264 2026-10-17 14:26:24

Tests(10/10):


Code:

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