一言难尽 @ 2019-07-03 18:15:33
#include<bits/stdc++.h>
using namespace std;
int i[9];
int main()
{
int a,b,c;
cin>>a>>b>>c;
int x,y,z;
int h,j;
int t=0;
for(x=123;x<=987;x++)
{
if(x%a!=0)
{
continue;
}
y=x/a*b;
z=x/a*c;
h=0;
j=1;
i[0]=x/100;
i[1]=x%10;
i[2]=x/10%10;
i[3]=y/100;
i[4]=y%10;
i[5]=y/10%10;
i[6]=z/100;
i[7]=z%10;
i[8]=z/10%10;
for(int d=0;d<9;d++)
{
h+=i[d];
j*=i[d];
}
if(h==45&&j==362880)
{
cout<<x<<' '<<y<<' '<<z<<endl;
t=1;
continue;
}
}
if(t==0)
{
cout<<"NO!!!";
}
return 0;
}
by 焚魂 @ 2019-07-05 22:41:28
我也看不出什么问题 你把最后输出的多余的那个换行去掉试试看
by Mingxuan @ 2019-08-21 14:40:13
No!!!o小写
by Mingxuan @ 2019-08-21 14:41:10
using namespace std;
int i[9];
int main()
int a,b,c;
cin>>a>>b>>c;
int x,y,z;
int h,j;
int t=0;
for(x=123;x<=987;x++)
{
if(x%a!=0)
{
continue;
}
y=x/a*b;
z=x/a*c;
h=0;
j=1;
i[0]=x/100;
i[1]=x%10;
i[2]=x/10%10;
i[3]=y/100;
i[4]=y%10;
i[5]=y/10%10;
i[6]=z/100;
i[7]=z%10;
i[8]=z/10%10;
for(int d=0;d<9;d++)
{
h+=i[d];
j*=i[d];
}
if(h==45&&j==362880)
{
cout<<x<<' '<<y<<' '<<z<<endl;
t=1;
continue;
}
}
if(t==0)
{
cout<<"No!!!";
}
return 0;
}