-->

12/5/20

Even Pair Sum December Long challenge problem solution

 Problem Statement-

This problem Even Pair sum is taken from December long challenge 2020. let's read the problem statement.

You are given two positive integers A and B. Find the number of pairs of positive integers (X,Y) such that 1XA1YB and X+Y is even.

Input

  • The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
  • The first and only line of each test case contains two space-separated integers A and B.

Output

For each test case, print a single line containing one integer ― the number of valid pairs.

Constraints

  • 1T1,000
  • 1A,B109

Subtasks

Subtask #1 (10 points): A,B10

Subtask #2 (10 points): A,B1,000

Subtask #3 (80 points): original constraints

Example Input

4
1 1
2 3
4 6
8 9

Example Output

1
3
12
36

Solution-

Hint- There is Very big role of even odd in this problem.
In this problem we have to calculate even and odd numbers till A and B.
because odd+odd=even
even +even =even
Here is my solution 

Join Telegram Channel for solution. 

Advertiser

all right reserved @technicalkeeda.in. Powered by Blogger.