Help me in solving LB01A problem

My issue

You are given 2 integers -

A and

C.
You need to find if there exists any







integer

B which meets the following condition


B must be an integer

B is the average of

A and

C.
For each test case, output

B. If no such integer exists, output

1
−1

My code

# Step 1: Read and understand the problem statement and sample test cases

# Click on 'Next' once you are ready to proceed.
t=int(input())
for i in range(t):
    a, c = map(int, input().split())
    b = (a+b)/2
    if b

i dont know how to solve this

drop if statement if (a+b)%2==0
then print yes else print no. Because if (a+b)%2!=0 then no integer exits which is average of given numbers and we dont need floating average

1 Like