80 pts WA #4 #9
查看原帖
80 pts WA #4 #9
1530321
Wzmois楼主2025/1/19 19:01
#include<bits/stdc++.h>
using namespace std;
int gcd(int x,int y){
int tp=x%y;
while(tp){
x=y;y=tp;tp=x%y;
}
return y;
}
int lcm(int x,int y)
{
return x*y/gcd(x,y);
}
int main(){
int x,y;
cin>>x>>y;
int zdgys=gcd(x,y),zxgbs=lcm(x,y),ans=0;
for(int i=zdgys;i<=sqrt(x*y);i++){
//cout<<i<<" "<<zxgbs/i<<endl;
if(gcd(i,x*y/i)==zdgys&&lcm(i,x*y/i)==zxgbs) ans++;
}
cout<<ans*2;
return 0;
}
2025/1/19 19:01
加载中...