#P1029. [NOIP 2001 普及组] 最大公约数和最小公倍数问题

    ID: 29 远端评测题 1000ms 125MiB 尝试: 8 已通过: 4 难度: 3 上传者: 标签>数学2001NOIp 普及组枚举,暴力最大公约数,gcd

[NOIP 2001 普及组] 最大公约数和最小公倍数问题

Description

Given two positive integers x0,y0x_0, y_0, find the number of pairs P,QP, Q that satisfy the following conditions:

  1. P,QP, Q are positive integers.
  2. P,QP, Q have greatest common divisor x0x_0 and least common multiple y0y_0.

Compute the number of all possible pairs (P,Q)(P, Q) that satisfy the conditions.

Input Format

One line with two positive integers x0,y0x_0, y_0.

Output Format

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

3 60

4

Hint

There are 4 possibilities for P,QP, Q:

  1. 3,603, 60.
  2. 15,1215, 12.
  3. 12,1512, 15.
  4. 60,360, 3.

Constraints: For 100%100\% of the testdata, 2x0,y01052 \le x_0, y_0 \le 10^5.

Source: NOIP 2001 Junior, Problem 2.

Translated by ChatGPT 5