Help in Adobe Online Assessment Problem (28-07-2022)

Revision en2, by FifthThread, 2022-07-29 08:29:48

Q1. Find the number of ordered positive pairs A,B such that the equation x^2-2Ax+B=0 as integral roots and B lies between L and R both inclusive.

Input Format: The first line conains a single integer T denoting the number of test cases The first line of each test case contains two integers l, r

Output: print number of ordered pairs for each test case

Constraints T<10

l,r < 10^12

Sample Input:

2

1 5

2 10

Output:

4

7

Explanation

For the first test case, the valid pairs are (1,1) (2,3) (2,4) (3,5)

My Approach:

a^2-b should be a perfect square, and a^2-b>=0. Now how to go further?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English FifthThread 2022-07-29 08:29:48 31
en1 English FifthThread 2022-07-29 08:29:11 657 Initial revision (published)