Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
116094 颜学俊逸 12奇数和与偶数和 C++ Accepted 3 MS 272 KB 228 2025-04-06 11:23:17

Tests(10/10):


Code:

#include <bits/stdc++.h> using namespace std; int main(){ int n,m,z=0,c=0; cin>>n>>m; for(int a = n;a<=m;a++){ if(a%2==0){ z=z+a; }else{ c=c+a; } } cout<<z<<" "<<c; return 0; }