Advertisement
dsiver144

ABCXYZ

Nov 25th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int a[4] = {1,2,3,4};
  4. int c[10];
  5. int b[4];
  6. int dem = 0;
  7.  
  8. int Check(int a[]) {
  9. if (a[0] == 0 || a[3] == 0) return 0;
  10. return 1;
  11. }
  12.  
  13. void Tim(int i) {
  14. int j;
  15. for (j = 0; j < 4; j++) {
  16. if (c[a[j]] != 1) {
  17. b[i] = a[j];
  18. c[a[j]] = 1;
  19. if (i == 3) {
  20. if (Check(b) == 1) {
  21. dem++;
  22. for (int g = 0; g < 4; g++) {
  23. printf("%d",b[g]);
  24. if (g == 2) printf(".");
  25. }
  26. printf("\n");
  27. }
  28. } else Tim(i+1);
  29. c[a[j]] = 0;
  30. }
  31. }
  32. }
  33.  
  34. int main() {
  35. Tim(0);
  36. printf("Vay co tat ca %d cach sap!",dem);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement