一个铺垫题
gcd递推
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b) {
int r=a%b;
while(r!=0) {
a=b;
b=r;
r=a%b;
}
return b;
}
int main() {
ll x,y,ans=0;
cin>>x>>y;
ll n=x*y;
for(ll i=2; i*i<=n; i++) {
if(n%i==0&&gcd(i,n/i)==x) {
if(i!=n/i) {
ans+=2;
} else {
ans++;
}
}
}
cout<<ans;
return 0;
}
完结