fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Ideone
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. Scanner in = new Scanner(System.in);
  10. Vector a = new Vector();
  11. while(in.hasNextDouble()){
  12. a.add(in.nextDouble());
  13. }
  14. int n=a.size()/2;
  15. int b=0;
  16. for(int i=0;i<n;i++){
  17. a.add(2*i+1,a.get(n+b+i));
  18. b++;
  19. }
  20. a.setSize(2*n);
  21. Double[] s = new Double[a.size()];
  22. a.toArray(s);
  23. for(int i=0;i<s.length;i++){
  24. if(s[i]==s[i].intValue()){
  25. System.out.print(s[i].intValue()+" ");
  26. }
  27. else{
  28. System.out.print(s[i]+" ");
  29. }
  30. }
  31. }
  32. }
Success #stdin #stdout 0.07s 4386816KB
stdin
1 2 3 4 5 6 7 8 9 10.5
stdout
1 6 2 7 3 8 4 9 5 10.5