https://www.luogu.org/problemnew/show/P1008
1 #include <stdio.h> 2 int main() 3 { 4 int a,b,c; 5 for(a=123; a<=333; a++) 6 { 7 b=a*2; 8 c=a*3; 9 if((a/100+a/10%10+a%10+b/100+b/10%10+b%10+c/100+c/10%10+c%10==1+2+3+4+5+6+7+8+9)&&((a/100)*(a/10%10)*(a%10)*(b/100)*(b/10%10)*(b%10)*(c/100)*(c/10%10)*(c%10)==(1)*(2)*(3)*(4)*(5)*(6)*(7)*(8)*(9))) 10 printf("%d %d %d ",a,b,c); 11 } 12 return 0; 13 }