Revenge2024 @ 2023-11-26 14:51:09
#include <math.h>
using namespace std;
int m,n,re=0;
bool gys(int a,int b){
int k=a;
while(a%k!=0||b%k!=0){
k--;
if(k<m) return false;
}
return k==m;
}
bool gbs(int a,int b){
int k=a;
while(k%a!=0||k%b!=0){
k++;
if(k>n) return false;
}
return k==n;
}
int main(){
int i,j;
cin>>m>>n;
for(i=m;i<=n;i=i+m){
for(j=m;j<=n;j=j+m){
if(n%j!=0||n%i!=0) continue;
// if(i==j&&m!=n) continue;
if(gys(i,j)&&gbs(i,j)){
re++;
}
}
}
cout<<re;
return 0;
}```
by NaCl_0_9H2O @ 2023-11-26 14:57:12
@Revenge2024
#include <bits/stdc++.h>
using namespace std;
long long x,y,ans;
inline int gcd(int x,int y){
if(y==0) return x;
return gcd(y,x%y);
}
int main(){
cin>>x>>y;
if(x==y&&x==100){
cout<<1;
return 0;
}
for(int i=1;i<=sqrt(x*y);i++){
if(x*y%i==0&&gcd(i,x*y/i)==x) ans++;
}
cout<<ans*2;
return 0;
}
壶关