Dipu and Interesting Numbers
Practice
4 (20 votes)
Binary search algorithm
Number theory
Algorithms
Easy
Mathematics
Open
Approved
Problem
75% Success 22002 Attempts 20 Points 3s Time Limit 256MB Memory 1024 KB Max Code

Little Dipu is a small kid and like all the other kids, he likes to play, but he plays with numbers (He is extraordinary you know). Now-a-days Dipu has some extra interest in odd numbers. So, he says that a number N is interesting if it has odd number of divisors. Now Dipu turns to you and asks you to tell him how many interesting numbers are there between two given numbers, L and R (both inclusive).

Input

First line of input contains the number of test cases T. Each of the next T lines contains two space separated integers L and R.

Output

For each test case, output an integer, denoting the count of interesting numbers between L and R (both inclusive).

Constraints

1 <= T <= 100000
1 <= L <= R <= 1018

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
13 votes
Tags:
Prime FactorizationEasyMathematicsFactorization
Points:20
44 votes
Tags:
MathematicsEasyNumber TheoryFactorization
Points:20
10 votes
Tags:
Number TheoryMathFactorizationTreesMathematicsNumber theoryInteger Factorization