fork(1) download
  1. # include <stdio.h>
  2. # include <stdlib.h>
  3.  
  4. # define N 3
  5.  
  6. int main();
  7. int recursive(long int iteration);
  8.  
  9. long int counter;
  10.  
  11. int main()
  12. {
  13. counter = 1;
  14. long int a = recursive(counter);
  15. long int result = a * N * sizeof(int);
  16.  
  17. // return 0;
  18. return result;
  19. }
  20.  
  21. int recursive(long int iteration)
  22. {
  23. if (malloc(sizeof(int)*iteration*N) == NULL)
  24. return counter;
  25. int locals[iteration * N];
  26. for (int i = 0; i < iteration * N; i++)
  27. {
  28. locals[i] = i + 1;
  29. }
  30.  
  31. for (int i = 0; i < iteration * N; i++)
  32. {
  33. if (locals[i] != i + 1)
  34. return iteration;
  35. }
  36.  
  37. //free(sizeof(int)*iteration*N);
  38. counter += 1;
  39. return recursive(counter);
  40. }
  41.  
Time limit exceeded #stdin #stdout 5s 8388607KB
stdin
Standard input is empty
stdout
Standard output is empty