P1029 最大公约数和最小公倍数问题
#include<bits/stdc++.h>
using namespace std;
int x,y,ans=0;
int gcd(int a,int b){
if (a%b==0) return b;
return gcd(b,a%b);
}
int main(){
scanf("%d%d",&x,&y);
for(int i=1;i<sqrt(x*y);i++){
if((x*y)%i==0&&gcd(i,x*y/i)==x)
ans+=2;
}
if(sqrt(x*y)==(int) sqrt(x*y)) ans++;
printf("%d",ans);
return 0;
}