Question: You are given a range of integers {L,L+1,,R}. An integer X is said to be Good if it can be represented as a sum of
You are given a range of integers {L,L+1,,R}. An integer X is said to be Good if it can be represented as a sum of two (not necessarily distinct) integers in this range. Find the number of distinct Good integers.
Input Format
Two integers L and R
Constraints
1LR10^6
Output Format
the number of Good integers.
Sample Input 0
2 2
Sample Output 0
1
Explanation 0
the only good number is 2 + 2 = 4
Sample Input 1
2 3
Sample Output 1
3
Explanation 1
There is three good number
2 + 2 = 4
2 + 3 = 5
3 + 3 = 6
Sample Input 2
1 3
Sample Output 2
5
Explanation 2
There is 5 distinct integers
1 + 1 = 2
1 + 2 = 3
1 + 3 = 4 OR 2 + 2 = 4
2 + 3 = 5
3 + 3 = 6
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
