0% found this document useful (0 votes)
6 views2 pages

Coding Question 5

Ramu has x 1-rupee coins and y 2-rupee coins and wants to divide the total amount equally between his sons. The input consists of multiple test cases with pairs of integers representing the number of coins. The output is 'YES' if the total amount can be evenly divided, and 'NO' otherwise.

Uploaded by

John Philip
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Coding Question 5

Ramu has x 1-rupee coins and y 2-rupee coins and wants to divide the total amount equally between his sons. The input consists of multiple test cases with pairs of integers representing the number of coins. The output is 'YES' if the total amount can be evenly divided, and 'NO' otherwise.

Uploaded by

John Philip
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Ramu has x 1 rupee coins and y 2 rupees coins.

He want to divide the money between his sons with same value.
Find it is possible or not?

Input Format:
The first line of input contains a single integer T,
denoting the number of testcases.
The description of T test cases follows.
Each test case consists of a single line of input containing
two space-separated integers X and Y.

Output Format:
print YES or NO in new line

Constraints
1≤T≤10^3
0≤X,Y≤10^8
X+Y>0

Sample Input:
4
2 2
1 3
4 0
1 10

Sample output
YES
NO
YES
NO

Explanation:
Test case 1: Ramu has 6 rupees and divide into 3 rupees each.
Test case 2: Ramu has 7 rupees and cannot divide into two equal halves.
Test case 3: Ramu has 4 rupees and divide into 2 rupees each.
Test case 4: Ramu has 11 rupees and cannot divide into two equal halves.

TC1:
5
2 2
4 4
6 6
8 8
10 10

OP1:
YES
YES
YES
YES
YES

TC2:
5
2 1
4 3
6 5
8 7
10 9

OP2:
YES
YES
YES
YES
YES

TC3:
5
0 1
0 3
0 5
0 7
0 9

OP3:
NO
NO
NO
NO
NO

TC4:
5
1 2
3 4
5 6
7 8
9 10

OP4:
NO
NO
NO
NO
NO

You might also like