C++ 代码
#include<iostream>
#include<cstdio>
using namespace std;
int main(void)
{
int i,j,n,number;
cin >> n;
int x,y;
for(i=1;i<=n;i++)
{
number = 0;
cin >> x >> y;
if(x>y)
{
int t = x;
x = y;
y = t;
}
for(j=x+1;j<y;j++)
{
if(j%2!=0) number+=j;
}
printf("%d\n",number);
}
return 0;
}