比赛 |
板子大赛 |
评测结果 |
AAAAAAAAAA |
题目名称 |
最大公约数和最小公倍数问题 |
最终得分 |
100 |
用户昵称 |
xxz |
运行时间 |
0.036 s |
代码语言 |
C++ |
内存使用 |
3.46 MiB |
提交时间 |
2025-01-22 11:09:52 |
显示代码纯文本
#include <bits/stdc++.h>
#define maxn ((int)1e5 + 4)
using namespace std;
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(){
freopen("gcdpro.in","r",stdin);freopen("gcdpro.out","w",stdout);
cin>>X0>>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;
}
printf("%d", ans);
return 0;
}