魏昊天 @ 2019-12-10 16:39:04
#include<bits/stdc++.h>
using namespace std;
bool f[11];
int a[11],b[4];
int co;
int x,y,z,ans;
void print(){
int m = a[1]*100+a[2]*10+a[3];
int p = a[4]*100+a[5]*10+a[6];
int q = a[7]*100+a[8]*10+a[9];
if(x*p == y*m && y*q == z*p &&x!=0&&y!=0&&z!=0){
b[1] = m;
b[2] = p;
b[3] = q;
sort(b+1,b+4);
ans++;
cout<<b[1]<<" "<<b[2]<<" "<<b[3]<<endl;
}
}
void dfs(int step){
if(step == 10){
print();
return;
}
for(int i = 1;i <= 9;i++){
if(f[i] == false){
f[i] = true;
a[step] = i;
dfs(step+1);
f[i] = false;
}
}
}
int main()
{
cin>>x>>y>>z;
dfs(1);
if(ans == 0) cout<<"NO!!!";
return 0;
}
by _StarBird_ @ 2019-12-10 16:42:11
NO!!! o要小写
by 魏昊天 @ 2019-12-10 17:26:41
@蒋陈和 谢谢大犇!!
by _StarBird_ @ 2019-12-11 08:38:54
@魏昊天 额
by _StarBird_ @ 2019-12-11 08:39:52
所以这种东西还是复制粘贴比较好