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 and . Find the number of pairs of positive integers such that , and is even.
Input
- The first line of the input contains a single integer denoting the number of test cases. The description of test cases follows.
- The first and only line of each test case contains two space-separated integers and .
Output
For each test case, print a single line containing one integer ― the number of valid pairs.
Constraints
Subtasks
Subtask #1 (10 points):
Subtask #2 (10 points):
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.
use long long instead of int
ReplyDelete