显示代码纯文本
#include <algorithm>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <vector>
#include <queue>
#define maxn ((int)1e5 + 4)
#if defined DEBUG
FILE *in = fopen("test", "r");
#define out stdout
#else
FILE *in = fopen("gcdpro.in", "r");
FILE *out = fopen("gcdpro.out", "w");
#endif
using namespace std;
inline void getint(int &x){
char c = fgetc(in);
while(!isdigit(c)) c = fgetc(in);
x = c - '0';
while(isdigit(c = fgetc(in)))x = x * 10 - '0' + c;
}
/*===========================================*/
int X0, Y0;
typedef long long LL;
LL mul;
inline LL gcd(LL x, LL y){
if(x == 0)return y;
return gcd(y % x, x);
}
int main(){
getint(X0), getint(Y0);
mul = (LL)X0 * Y0;
int i, m, ans = 0, P, Q, t;
m = Y0 / X0;
for(P = X0;P <= Y0;P += X0){
if(mul % P)continue;
Q = mul / P;
if(Q % X0)continue;
if(gcd(P, Q) != X0)continue;
++ans;
}
fprintf(out, "%d\n", ans);
return 0;
}