yangzijin @ 2024-08-19 22:18:56
#include<bits/stdc++.h>
using namespace std;
bool f[101];
int n[100];
int main(){
int a,b,c;
cin>>a>>b>>c;
for(int i=123;i<329;i++){
memset(n,0,sizeof(n));
n[1]=a*i%10;n[2]=a*i/10%10;n[3]=a*i/100%10;
n[4]=b*i%10;n[5]=b*i/10%10;n[6]=b*i/100%10;
n[7]=c*i%10;n[8]=c*i/10%10;n[9]=c*i/100%10;
memset(f,0,sizeof(f));
bool flag=0;
for(int j=1;j<=9;j++){
if(f[n[j]]==1||n[j]==0){
flag=1;
break;
}
else f[n[j]]=1;
}
if(flag==0)cout<<i<<" "<<2*i<<" "<<3*i<<endl;
}
return 0;
}
by haimingbei @ 2024-08-19 22:30:57
@yangzijin 用next_permutation( )
by yangzijin @ 2024-08-20 21:39:12
@haimingbei ,指针还没学。。。。