显示代码纯文本
#include <iostream>
#include <fstream>
using namespace std;
int x0, y0, ans = 0, yx;
long long xy;
inline int gcd(int, int);
ifstream fin("gcdpro.in");
ofstream fout("gcdpro.out");
#define cin fin
#define cout fout
main()
{
// gcd(P, Q) * lcm(P, Q) = P * Q
int p, q;
cin >> x0 >> y0;
xy = (long long)x0 * y0;
yx = y0 / x0;
for (p = x0; p <= y0; p += x0){
if (xy % p)
continue;
q = xy / p;
if (q % x0)
continue;
if (gcd(p, q) == x0)
ans++;
}
cout << ans;
// for(;;);
}
inline int gcd(int x, int y){
int r;
while (x % y){
r = x % y;
x = y;
y = r;
}
return y;
}