YCY1234567890 @ 2024-07-25 17:25:07
1618求解!!!
by haimingbei @ 2024-07-25 17:31:18
@YCY1234567890
(用next_permutation很方便)
#include<bits/stdc++.h>
using namespace std;
int main(){
int A,B,C,a[9]={1,2,3,4,5,6,7,8,9};
cin>>A>>B>>C;
bool f=0;
do{
int x=a[0]*100+a[1]*10+a[2];
int y=a[3]*100+a[4]*10+a[5];
int z=a[6]*100+a[7]*10+a[8];
if(x*B==y*A && y*C==z*B)
cout<<x<<" "<<y<<" "<<z<<endl,f=1;
}while(next_permutation(a,a+9));
if(f==0)cout<<"No!!!";
return 0;
}
by YCY1234567890 @ 2024-07-31 15:59:26
@haimingbei 谢谢