比赛 板子大赛 评测结果 AAAAAAAAAA
题目名称 最大公约数和最小公倍数问题 最终得分 100
用户昵称 AeeE5x 运行时间 0.054 s
代码语言 C++ 内存使用 3.27 MiB
提交时间 2025-01-22 15:13:34
显示代码纯文本
#include<iostream> 
#include<algorithm>
#include<vector>
using namespace std;
//int f(int x){
//    int res=0;
//    for(int i=2;i<=x;i++){
//        if(x%i==0){
//            while(x%i==0) x/=i;
//            res++;
//        }
//    }
//    return res;
//}
int main(){
    freopen("gcdpro.in","r",stdin);
    freopen("gcdpro.out","w",stdout);
    
//    int a,b;cin>>a>>b;
//    b/=a;
//    int p=f(b);
//    long long ans=1,w=2;
//    while(p){
//        if(p&1) ans*=w;
//        w*=w;
//        p>>=1;
//    }
//    cout<<ans;
    
    int ans=0;
    long long x,y;cin>>x>>y;
    for(long long p=x;p<=y;p++){
        if(p%x!=0||y%p!=0) continue;
        long long q=y/p*x;
        if(__gcd(p,q)==x) ans++;
    }
    cout<<ans;
    
    return 0;
}