P1029 [NOIP 2001 Junior] Greatest Common Divisor and Least Common Multiple Problem

Description

Given two positive integers $x_0, y_0$, find the number of pairs $P, Q$ that satisfy the following conditions: 1. $P, Q$ are positive integers. 2. $P, Q$ have greatest common divisor $x_0$ and least common multiple $y_0$. Compute the number of all possible pairs $(P, Q)$ that satisfy the conditions.

Input Format

One line with two positive integers $x_0, y_0$.

Output Format

One line with a single number, representing the number of pairs $P, Q$ that satisfy the conditions.

Explanation/Hint

There are 4 possibilities for $P, Q$: 1. $3, 60$. 2. $15, 12$. 3. $12, 15$. 4. $60, 3$. Constraints: For $100\%$ of the testdata, $2 \le x_0, y_0 \le 10^5$. Source: NOIP 2001 Junior, Problem 2. Translated by ChatGPT 5