Nightmare09 @ 2017-07-17 12:44:50
# include<cmath>
# include<iostream>
# include<cstring>
# include<algorithm>
# include<vector>
const int MAX_=10;
using namespace std;
double A,B,C,dp[MAX_],sum=0;
int fun1(int n)
{
if(n/1000>0) return 1;
while(n)
{
if(!dp[n%10]) dp[n%10]=1;
else return 1;
n/=10;
}
return 0;
}
void fun()
{
for(double i=100;i<=999;i++)
{
memset(dp,0,sizeof(dp));
dp[0]=1;
if(fun1(i*A)) continue;
if(fun1(i*B)) continue;
if(fun1(i*C)) continue;
sum++;
cout<<i*A<<" "<<i*B<<" "<<i*C<<endl;
}
if(!sum) cout<<"NO!!!";
return;
}
int main()
{
cin>>A>>B>>C;
fun();
return 0;
}
by 墨明棋妙 @ 2017-07-26 19:30:06
你数据范围问题
看我的吧
#include<cstdio>
int main()
{
int a,b,c;
int f[10];
int k1,k2,k3;
scanf("%d%d%d",&k1,&k2,&k3);
bool yes=true;
for(int k=123;k*k3/k1<=987;k++)
{
a=k;
b=a*k2/k1;
c=a*k3/k1;
for(int i=1;i<=9;i++)f[i]=0;
while(a>1||b>1||c>1){
f[a%10]=f[b%10]=f[c%10]=1;
a/=10;
b/=10;
c/=10;
}
bool ok=true;
for(int i=1;i<=9;i++)if(f[i]==0)ok=false;
if(ok)printf("%d %d %d\n",k,k*k2/k1,k*k3/k1),yes=false;
}
if(yes)printf("No!!!");
return 0;
}