显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<vector>
#include<algorithm>
#include<stack>
#include<string>
#include<cmath>
using namespace std;
int x,y;
int all;
bool gcd(int p,int q)
{
while(p!=q)
{
int lin=max(p,q)-min(p,q);
p=min(p,q);q=lin;
}
if(p==x)return 1;
return 0;
}
int main()
{
freopen("gcdpro.in","r",stdin);
freopen("gcdpro.out","w",stdout);
scanf("%d%d",&x,&y);
if(x==y)
{
printf("1");return 0;
}
for(int i=x;i<=y;i+=x)
{
if(x*y%i)continue;
int j=x*y/i;
if(j%x)continue;
if(!gcd(i,j))continue;
all++;
}
printf("%d",all);
return 0;
}