nbtngnllmd @ 2022-09-13 19:09:46
https://www.luogu.com.cn/paste/v2mifk97
样例7:123 456 789
by LJKX @ 2022-09-13 19:21:58
#include<iostream>
using namespace std;
int a,b,c,x,y,z,l;
int check1()
{
int s[9];
s[0]=a/100,s[1]=a%100/10,s[2]=a%10;
s[3]=b/100,s[4]=b%100/10,s[5]=b%10;
s[6]=c/100,s[7]=c%100/10,s[8]=c%10;
for(int i=0;i<9;i++)
for(int j=i;j<8;j++)
{
if(s[i]==s[j+1])return 0;
if(s[i]==0)return 0;
}
return 1;
}
int check2()
{
if(a*y==b*x&&a*z==c*x)
return 1;
return 0;
}
int check3()
{
if(b>=1000||c>=1000)
return 0;
return 1;
}
int main()
{
cin>>x>>y>>z;
if(!x||!y||!z)
{
cout<<"No!!!";
return 0;
}
for(a=123;a<333;a++)
{
b=a*y/x;
c=a*z/x;
if(check1()&&check2()&&check3())
cout<<a<<' '<<b<<' '<<c<<endl,l++;
}
if(!l)
cout<<"No!!!";
return 0;
}