C++ 代码
#include<cstdio>
#include<algorithm>
#include<iostream>
int main(){
int a,b,sum=0;
scanf("%d%d",&a,&b);
if(a>b) {
int t=a;
a=b;
b=t;
}
//printf("%d%d",a,b);
for(int i = a+1;i<b;i++){
if(i%2==1 || i%2==-1){
sum+=i;
}
}
printf("%d",sum);
return 0;
}