fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(void) {
  5. int* a, i, k, n;
  6. n = 13;
  7. k = 4;
  8. a = (int*)malloc(n * sizeof(int));
  9. for (i = 0; i < n; ++i)
  10. a[i] = i + 1;
  11. for (i = 0; i < n; i ++)
  12. a[i] = a[i + i/(k-1)];
  13. for (i = 0; i < n - n/k ; i++)
  14. printf("%d ", a[i]);
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 4964KB
stdin
Standard input is empty
stdout
1 2 3 5 6 7 9 10 11 13