sxLiang_1229 @ 2024-09-07 20:51:14
#include<bits/stdc++.h>
using namespace std;
int b[11];
void go(int x){
b[x%10]=1;
b[x/10%10]=1;
b[x/100]=1;
}
bool check(int x,int y,int z){
memset(b,0,sizeof(b));
if(y>999||z>999) return 0;
go(x),go(y),go(z);
for(int i=1;i<=9;i++)
if(!b[i]) return 0;
return 1;
}
int main(){
long long A,B,C,x,y,z,cnt=0;
cin>>A>>B>>C;
for(x=123;x<=987;x++){
if(x*B%A||x*C%A) continue;
y=x*B/A, z=x*C/A;
if(check(x,y,z)){
printf("%lld %lld %lld\n",x,y,z); cnt++;
}
}
if(!cnt) puts("NO!!!");
return 0;
}
by sxLiang_1229 @ 2024-09-07 22:16:14
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int a[15];
int main(){
long long A,B,C,x,y,z,cnt=0;
cin>>A>>B>>C;
for(int i=1;i<=9;i++){
a[i]=i;
}
do{
x=a[1]*100+a[2]*10+a[3];
y=a[4]*100+a[5]*10+a[6];
z=a[7]*100+a[8]*10+a[9];
if(x*B==y*A&&y*C==z*B){
printf("%lld %lld %lld\n",x,y,z),cnt++;
}
}while(next_permutation(a+1,a+10));
if(!cnt) puts("No!!!");
return 0;
}
by sxLiang_1229 @ 2024-09-07 22:16:56
已解决,谢谢
by sxLiang_1229 @ 2024-09-07 22:18:37
大家需要注意最后No!!!的输出QAQ