fork(4) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner sc = new Scanner(System.in);
  13. int n = sc.nextInt();
  14. String answer = "";
  15. if(!isPossible(n)) System.out.println("NIE");
  16. else {
  17. for(int i = 1; i <= n; i = i + 2) {
  18. answer += i + " ";
  19. }
  20. for(int i = 0; i <=n; i = i + 2) {
  21. answer += i + " ";
  22. }
  23. }
  24. System.out.println(answer);
  25. }
  26.  
  27. private static boolean isPossible(int n) {
  28. if (n == 0) return true;
  29. else if (n < 3) return false;
  30. return true;
  31. }
  32. }
  33.  
Time limit exceeded #stdin #stdout #stderr 5s 974848KB
stdin
1000000
stdout
Standard output is empty
stderr
Java HotSpot(TM) Client VM warning: No monotonic clock was available - timed services may be adversely affected if the time-of-day clock changes