A quadratic equation
Practice
2.7 (36 votes)
Basic number theory 2
Algorithms
Math
Number theory
Problem
60% Success 5793 Attempts 50 Points 4s Time Limit 256MB Memory 1024 KB Max Code
Find the number of ordered positive pairs $$(B, C)$$ such that the equation $$ x^2 - 2Bx + C = 0$$ has integral roots and $$C$$ lies between $$L$$ and $$R$$ both inclusive.
Input format
- The first line contains a single integer $$T$$ denoting the number of test cases.
- The first line of each test case contains two space-separated integers $$L$$ and $$R$$ denoting the range of $$C$$.
Output format
For each test case, print a single integer denoting the number of ordered positive pairs possible. The output for each test case must be printed in a separate line.
Constraints
$$1 \leq T \leq 10$$
$$1 \leq L, R \leq 10^{12}$$
Submissions
Please login to view your submissions
Similar Problems
Points:50
10 votes
Tags:
AlgorithmsMathNumber TheoryNumber theoryPrime Factorization
Points:50
16 votes
Tags:
CombinatoricsMathNumber Theory
Editorial