fork download
  1. #include <stdio.h>
  2.  
  3. #define MAXX 11
  4.  
  5. int n[10]={0};
  6. long long int ans=0;
  7. int found = 0;
  8.  
  9.  
  10. void find(int x) {
  11.  
  12. int i,sum=1;
  13. if (x==12 ) {
  14.  
  15. for (i=1; i<=9;i++) {
  16. sum = sum * n[i];
  17. }
  18. if (sum>0 && ans % 2 ==0 && ans % 3 ==0 && ans % 7==0 && ans %9==0 && ans % 4==0) {
  19.  
  20. found = 1;
  21.  
  22. printf("ans is:%lld\n",ans);
  23. }
  24. } else {
  25. for (i = 1; i<= 9; i++) {
  26. if ( i!=5 && n[i]< MAXX-7 && found ==0) {
  27. n[i] ++;
  28. ans = ans*10+i;
  29. find(x+1);
  30. n[i] --;
  31. ans = ans /10;
  32. }
  33. }
  34. }
  35.  
  36. return;
  37. }
  38.  
  39. int main() {
  40.  
  41. printf("hello\n");
  42. n[5] = 1;
  43.  
  44. find(1);
  45.  
  46. return 0;
  47. }
Success #stdin #stdout 0.08s 2052KB
stdin
Standard input is empty
stdout
hello
ans is:11123348796