2032 奇数求和
#include<bits/stdc++.h> #define f(i,s,e) for(int i = s; i <= e; i++) #define ll long long using namespace std; const int N = 1e3+10,inf = 0x3f3f3f3f; int main() { int m,n,sum = 0; cin >> m >> n; for(int i = m; i <= n; i++) { if(i % 2 == 1) //i为奇数 { sum += i; //累加i } } cout << sum; return 0; }