fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class U415 {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8. int n, m;
  9. n = scanner.nextInt();
  10. m = scanner.nextInt();
  11. double[] A = new double[n];
  12. double[] B = new double[m];
  13. double[] C = new double[n + m];
  14. for (int i = 0; i < n; i++) {
  15. A[i] = scanner.nextDouble();
  16. }
  17. for (int i = 0; i < m; i++) {
  18. B[i] = scanner.nextDouble();
  19. }
  20. for (int i = 0; i < n + m; i++){
  21. if (i < n) {
  22. C [i] = A[i];
  23. }
  24. else {
  25. C [i] = B[i - n];
  26. }
  27. }
  28. System.out.println(Arrays.toString(C));
  29. }
  30. }
Success #stdin #stdout 0.16s 321344KB
stdin
2
9
9 3.6
7.4 3.6 4.6666 7.99702 1 1 1 1 1
stdout
[9.0, 3.6, 7.4, 3.6, 4.6666, 7.99702, 1.0, 1.0, 1.0, 1.0, 1.0]