Etic_HAO @ 2022-08-21 14:46:56
#include<bits/stdc++.h>
int a,b,c,i,j,h[100],x,y,z,t=1,ans;
using namespace std;
int gcd(int m,int n)
{
if(n%m!=0)
{
n=n%m;
return gcd(n,m);
}
else return m;
}
int main()
{
cin>>a>>b>>c;
x=gcd(a,b); y=gcd(b,c); z=gcd(x,y);
a/=z; b/=z; c/=z;
for(i=123;i<=333;i++)
{
if(i%a==0)
{
x=i;
y=i/a*b;
z=i/a*c;
for(j=1;j<=3;j++)
{
h[x%10]++; h[y%10]++; h[z%10]++;
x/=10; y/=10; z/=10;
}
for(j=1;j<=9;j++)
{
if(h[j]==0) t=0;
h[j]=0;
}
x=i;
y=i/a*b;
z=i/a*c;
if(t!=0)
{
cout<<x<<' '<<y<<' '<<z<<endl;
ans++;
}
t=1;
}
}
if(ans==0) cout<<"No!!!"<<endl;
return 0;
}
by OhanaTyan @ 2022-08-21 15:01:40
特别判断一下a是不是0就好了
by Etic_HAO @ 2022-08-21 15:10:43
@yxyjssxs 谢谢