不会看我的
2025-05-19 20:27:21
发布于:广东
1阅读
0回复
0点赞
// 暴力过不了啊!!!!
#include <bits/stdc++.h>
#define int long long
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) x*y/gcd(x, y)
using namespace std;
int t;
int a0, a1, b0, b1;
signed main(){
cin >> t;
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
while (t--){
cin >> a0 >> a1 >> b0 >> b1;
int ans=0;
for (int x=1;x<=sqrt(b1);x+=1){
if (b1%x==0){
if (gcd(x, a0)==a1 && lcm(x, b0)==b1){
ans++;
}
if (x!=b1/x && gcd(b1/x, a0)==a1 && lcm(b1/x, b0)==b1) ans++;
}
}
cout << ans << "\n";
}
return 0;
}
这里空空如也
有帮助,赞一个