SKT_T1_Faker_ @ 2017-06-12 13:41:54
#include<iostream>
#include<memory.h>
using namespace std;
int main()
{
int a,b,c,i,s,j;
bool asa[100000],k=false;
cin>>a>>b>>c;
for(i=123; i<=987; i++)
{
s=0;
memset(asa,false,sizeof(asa));
asa[i*a/100]=
asa[i*a/10%10]=
asa[i*a%10]=
asa[i*b/100]=
asa[i*b/10%10]=
asa[i*b%10]=
asa[i*c/100]=
asa[i*c/10%10]=
asa[i*c%10]=1;
for(j=1; j<=9; j++)
s+=asa[j];
if(s==9)
cout<<i*a<<' '<<i*b<<' '<<i*c<<'\n',
k=true;
}
if(!k)
cout<<"No!!!";
return 0;
}
by redegg @ 2017-07-04 20:30:35
巧了,请问您解决了吗,我的代码很像
#include <bits/stdc++.h>
using namespace std;
int a[20];
int ok=0;
int main()
{
int e,r,t;
cin>>e>>r>>t;
for(int i=100;i<334;i++)
{
int x,y,z;
x=i;
y=(r/e)*x;
z=(t/e)*x;
int a=x,b=y,c=z;
int x1[3],y1[3],z1[3];
//cout<<x<<" "<<y<<" "<<z<<endl;
x1[0]=x%10;
x/=10;
x1[1]=x%10;
x/=10;
x1[2]=x%10;
y1[0]=y%10;
y/=10;
y1[1]=y%10;
y/=10;
y1[2]=y%10;
z1[0]=z%10;
z/=10;
z1[1]=z%10;
z/=10;
z1[2]=z%10;
bool o=1;
int k[10];
memset(k,0,sizeof(k));
for(int j=0;j<3;j++)
{
k[x1[j]]++;
k[y1[j]]++;
k[z1[j]]++;
//cout<<x1[j]<<" x "<<y1[j]
}
for(int j=1;j<10;j++)
{
//cout<<k[j]<<" k "<<endl;
if(k[j]>1||k[j]==0)o=0;
}
if(o)
{
ok=1;
cout<<a<<" "<<b<<" "<<c<<endl;
}
}
if(ok==0)cout<<"No!!!"<<endl;
return 0;
}
by Eric周 @ 2019-08-31 11:22:45
我也是醉了,c++程序
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;bool flag=false;
cin>>a>>b>>c;
int s1,s2,s3;bool num[10];
for(s1=100;s1<=999;s1++)
{
memset(num,false,sizeof(num));
s2=s1/a*b;s3=s1/a*c;
if(s2>=1000||s3>=1000) break;
num[s1/100]=true;num[(s1/10)%10]=true;num[s1%10]=true;
num[s2/100]=true;num[(s2/10)%10]=true;num[s2%10]=true;
num[s3/100]=true;num[(s3/10)%10]=true;num[s3%10]=true;
if(!(num[1]&&num[2]&&num[3]&&num[4]&&num[5]&&num[6]&&num[7]&&num[8]&&num[9])) continue;
if(s1/100+(s1/10)%10+s1%10+s2/100+(s2/10)%10+s2%10+s3/100+(s3/10)%10+s3%10==45)
{
flag=true;
cout<<s1<<' '<<s2<<' '<<s3<<endl;
}
}
if(!flag) cout<<"No!!!";
return 0;
}