我就是要反着来,骗分骗分

魈凯KBS  •  6个月前


直接,暴力枚举

include<bits/stdc++.h>

using namespace std; int main(){

int i,s = 0,a,b,c,d; cin>>a>>b; if(a % 2 == 0){

c = a + 1;

}else{

c = a;

} if(b % 2 == 0){

d = b - 1;

}else{

d = b;

} for(i = c;i <= d;i+=2){

s = s + i;

} cout<<s<<endl; }


评论:

其实用奥数DOING更简单一点

include

include

using namespace std;

long long n, m;

int main() {

cin >> n >> m;
if (n % 2 == 0) {
    n++;
}
if (m % 2 == 0) {
    m--;
}
cout << (n+m)*((m-n)/2+1)/2 << endl;
return 0;

}


魈凯KBS  •  6个月前

望丰展?使MD


EUCLID  •  6个月前

666666666666666666666666


wanghaichen  •  4个月前