#abc206e. E - Divide Both
E - Divide Both
Score : points
问题描述
给定整数 和 ,找出满足以下所有条件的整数对 的数目:
- 设 为 和 的最大公约数(Greatest Common Divisor, GCD)。则满足以下条件:
- ,且 ,同时 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Given integers and , find the number of pairs of integers satisfying all of the conditions below:
- Let be the greatest common divisor of and . Then, the following holds.
- , , and .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer as an integer.
Sample Input 1
3 7
Sample Output 1
2
Let us take some number of pairs of integers, for example.
- satisfies the conditions.
- has and thus violates the condition.
- has and thus violates the condition.
There are two pairs satisfying the conditions: .
Sample Input 2
4 10
Sample Output 2
12
Sample Input 3
1 1000000
Sample Output 3
392047955148
update @ 2024/3/10 09:19:41