upto_300 @ 2023-10-16 21:56:35
思路:枚举全排列&判断是否满足条件
#include<bits/stdc++.h>
typedef long double ld;
using namespace std;
int a,b,c,x[]{1,0,2,3,4,5,6,7,8,9},out;
bool can(int x1,int x2,int x3){
return abs((ld)x1/x2-(ld)a/b)<0.00001&&abs((ld)x2/x3-(ld)b/c)<=0.00001;
}
int main(){
cin>>a>>b>>c;
do{
int x1=x[0]*100+x[1]*10+x[2],x2=x[3]*100+x[4]*10+x[5],x3=x[6]*100+x[7]*10+x[8];
if(can(x1,x2,x3)){
out++;
cout<<x1<<' '<<x2<<' '<<x3<<'\n';
}
}while(next_permutation(x,x+10));
if(!out)cout<<"No!!!";
}