Eric周 @ 2019-08-31 11:20:59
80分,就差最后一个点
#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;
}
没问题啊!
by 反手for循环 @ 2019-08-31 11:30:59
输出太多。
by Eric周 @ 2019-08-31 11:40:58
蟹蟹
by muxii @ 2019-08-31 11:41:15
就是你比标答多输出了
by Eric周 @ 2019-08-31 11:47:08
蟹蟹,我AC了
by Eric周 @ 2019-08-31 11:47:45
后边应该先乘后除,s1,s2,s3
by Eric周 @ 2019-08-31 11:49:28
#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*b/a;s3=s1*c/a;//先乘后除可以化简比
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;
}
by AquaRio @ 2019-08-31 11:59:53
@23周到 Too MAny lines = TMA 是一个著名的电影厂商