P1072 Hankson 的趣味题
作者:互联网
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n;
ll a0, a1, b0, b1;
int main() {
cin >> n;
while(n--) {
cin >> a0 >> a1 >> b0 >> b1;
ll ans = 0;
for(ll i = 1; i * i <= b1; i++) {
if(b1 % i)
continue;
if(i % a1 == 0 && i >= a1 && __gcd(b1 / b0, b1 / i) == 1 && __gcd(a0 / a1, i / a1) == 1)
ans++;
if((b1 / i) % a1 == 0 && (b1 / i) >= a1 && i * i != b1 && __gcd(b1 / b0, b1 / (b1 / i)) == 1 && __gcd(a0 / a1, (b1 / i) / a1) == 1)
ans++;
}
cout << ans << endl;
}
return 0;
}
标签:__,gcd,a1,b0,b1,&&,趣味,P1072,Hankson 来源: https://blog.csdn.net/Endeavor_G/article/details/89150761