rabbitzph @ 2021-09-12 15:54:20
#include<bits/stdc++.h>
using namespace std;
int x,y,z,sum;
int a[11],b[11];
int main(){
cin>>x>>y>>z;
for(int i = 1;i<10;i++) a[i] =1;
int judge = 1;
for( b[1] = 1;b[1]<10;b[1]++){
a[b[1]]=0 ;
for( b[2] = 1;b[2]<10;b[2]++){a[b[2]]=0 ;
for( b[3] = 1;b[3]<10;b[3]++){a[b[3]]=0 ;
for( b[4] = 1;b[4]<10;b[4]++){a[b[4]]=0 ;
for( b[5] = 1;b[5]<10;b[5]++){a[b[5]]=0 ;
for( b[6] = 1;b[6]<10;b[6]++){a[b[6]]=0 ;
for( b[7] = 1;b[7]<10;b[7]++){a[b[7]]=0 ;
for( b[8] = 1;b[8]<10;b[8]++){a[b[8]]=0 ;
for( b[9] = 1;b[9]<10;b[9]++){a[b[9]]=0 ;
for(int i = 1;i<10;i++){
if(a[i]){
judge = 0;
break;
}
}
if(judge){
if((b[1]*100+b[2]*10+b[3])==((b[4]*100+b[5]*10+b[6])/2)||((b[4]*100+b[5]*10+b[6])/2)==(b[7]*100+b[8]*10+b[9])/3){
cout<<b[1]*100+b[2]*10+b[3]<<" "<<b[4]*100+b[5]*10+b[6]<<" "<<(b[7]*100+b[8]*10+b[9])<<endl;
}
}
sum=0;
judge = 1;
for(int i = 1;i<10;i++) a[i] =1;
}
}
}
}
}
}
}
}
}
return 0;
}
by qzhw @ 2021-09-12 16:21:03
这么多循环不卡才怪
by rabbitzph @ 2021-09-14 11:38:25
@qzhw ..