Rick15999640961 @ 2024-07-14 16:08:14
#include<bits/stdc++.h>
using namespace std;
#define int long long
int a,b,ans;
signed main(){
cin>>a>>b;
for(int i=a;i<=b;i++){
if(i%a!=0||b%i!=0)continue;
else{
for(int j=a;j<=b;j++){
if(j%a!=0||b%j!=0||i==j)continue;
bool flag=0;
for(int k=min(i,j);k>=a;k--){
if(i%k==0&&j%k==0){
if(k!=a)flag=1;
}
}
if(flag)continue;
for(int k=max(i,j);k<=b;k++){
if(k%i==0&&k%j==0){
if(k!=b){
flag=1;
}
}
}
if(flag)continue;
if(i*j==a*b){
ans++;
}
}
}
}
cout<<ans;
return 0;
}
by Rick15999640961 @ 2024-07-14 16:09:42
加上特判if(ans>0&&a==b)ans--;也过不了
by jeff121110 @ 2024-07-14 16:33:03
a=b要输出1