fork download
  1. #include <stdio.h>
  2. int main (void)
  3. {
  4. unsigned long long n, k, x, y, a[1000000];
  5. scanf ("%llu%llu", &n, &k);
  6. if (n % 2 == 0)
  7. {
  8. for (x = 1, y = 1; x <= n - 1; x + 2)
  9. {
  10. a[y] = x;
  11. y = y + 1;
  12. }
  13. for (y, x = 2; x <= n; x + 2)
  14. {
  15. a[y] = x;
  16. y = y + 1;
  17. }
  18. }
  19. else if (n % 2 != 0)
  20. {
  21. for (x = 1, y = 1; x <= n; x + 2)
  22. {
  23. a[y] = x;
  24. y = y + 1;
  25. }
  26. for (y, x = 2; x <= n - 1; x + 2)
  27. {
  28. a[y] = x;
  29. y = y + 1;
  30. }
  31. }
  32.  
  33. printf ("%llu\n", a[k]);
  34. return 0;
  35. }
Time limit exceeded #stdin #stdout 5s 9984KB
stdin
7 7
stdout
Standard output is empty