Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
958 B
1
Indexable
Never
#include <stdio.h>
int main()
{
    long long A, B, odd;
    int t;
    scanf("%d", &t);
    for (int j = 1; j <= t; j++)
    {
        
        scanf("%lld %lld", &A, &B);

        if (A < B)
        {
            int sum = 0;
            for (int i = A+1; i < B;i++ )
            {
                
                odd = i % 2;
                if (odd != 0)
                {
                    sum = sum + i;
                }
            }
            printf("%d\n", sum);
        }
        else if (B < A )
        {
            int sum = 0;
            for (int i = B+1; i < A; i++)
            {
                
                odd = i % 2;
                if (odd != 0)
                {
                    sum = sum + i;
                }
            }
            printf("%d\n", sum);
        }
        else if (A==B)
        {
            printf("0\n");
        }
             
        
    }

}