提交时间:2024-11-04 21:05:11

运行 ID: 55288

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