auspicious2013 @ 2024-08-16 18:16:23
这道题看了N遍
各位大佬行行好,给个思路就行。
by lyzhsxx @ 2024-08-16 18:21:58
暴力枚举所有情况,就可以AC
by lyzhsxx @ 2024-08-16 18:25:01
参考代码
#include<bits/stdc++.h>
using namespace std;
int a[15];
void f(int x){
int y=x%10;
int y1=x/10%10;
int y2=x/100;
a[y]++;
a[y1]++;
a[y2]++;
}
int main(){
int a1,b,c;
cin>>a1>>b>>c;
bool f1=0;
for(int i=1;i<=1000;i++){
int t=a1*i;
int t1=b*i;
int t2=c*i;
if(t<100||t>1000||t2<100||t2>1000||t1<100||t1>1000) continue;
f(t);
f(t1);
f(t2);
bool flag=1;
for(int j=1;j<=9;j++){
if(a[j]!=1){
flag=0;
break;
}
}
if(flag){f1=1;cout<<t<<" "<<t1<<" "<<t2<<"\n";}
memset(a,0,sizeof(a));
}
if(f1==0) cout<<"No!!!";
return 0;
}
by auspicious2013 @ 2024-08-16 18:33:24
@lyzhsxx Thanks.