GCD and LCM - MarisaOJ: Marisa Online Judge

GCD and LCM

Time limit: 1000 ms
Memory limit: 256 MB
Given two positive integers $u, v$, count the number of pairs of positive integers $x, y$ such that their greatest common divisor is $u$ and their least common multiple is $v$. ### Input - A single line containing two positive integers $u, v$. ### Output - Print the number of pairs satisfying the conditions. ### Constraints - $1 \le u, v \le 10^6$. ### Example Input: ``` 3 60 ``` Output: ``` 4 ``` There are $4$ pairs satisfying the conditions: - $(3, 60)$. - $(12, 15)$. - $(15, 12)$. - $(60, 3)$.