Java 代码
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in);
int a = cin.nextInt();
int b = cin.nextInt();
if (a > b)
{
int temp = a;
a = b;
b = temp;
}
int sum = 0;
for (int i = a+1; i < b; i ++)
{
if (i % 2 != 0)
sum += i;
}
System.out.println (sum);
}
}