Good Pairs
CodeChefOpen on judge ↗
A pair of integers $(a, b)$ is defined to be good, if $GCD(a, b) = x$ and $LCM(a, b) = y$, where $GCD(a, b)$ denotes the greatest common divisor of $a$ and $b$, and $LCM(a, b)$ denotes the least common multiple of $a$ and $b$. You are given two integers $x$ and $y$. You are to find the number of good pairs of integers $(a, b)$ such that $l ≤ a, b ≤ r$. Note that pairs $(a, b)$ and $(b, a)$ ar
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start