SHARE
TWEET

RMI

a guest Oct 21st, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.text.DecimalFormat;
  2. import java.util.Arrays;
  3. import java.util.List;
  4. import java.util.Scanner;
  5. import java.util.stream.Collectors;
  6. import java.util.ArrayList;
  7. import java.util.Arrays;
  8. import java.util.List;
  9. import java.util.Scanner;
  10. import java.util.stream.Collectors;
  11.  
  12. public class ExcellentResult {
  13.     public static void main(String[] args) {
  14.         Scanner sc = new Scanner(System.in);
  15.         List<Double> inpNumbers1 = Arrays.stream(sc.nextLine().split(" ")).map(Double::parseDouble).collect(Collectors.toList());
  16.         List<Double> inpNumbers2 = Arrays.stream(sc.nextLine().split(" ")).map(Double::parseDouble).collect(Collectors.toList());
  17.         List<Double> outputNumbers = new ArrayList<>();
  18.         int lowestCount;
  19.         int mostCount;
  20.         if(inpNumbers1.size()<inpNumbers2.size()) {
  21.             for (int i = 0; i <= inpNumbers1.size() - 1; i++) {
  22.                 outputNumbers.add(inpNumbers1.get(i));
  23.                 outputNumbers.add(inpNumbers2.get(i));
  24.             }
  25.             for (int i = inpNumbers1.size(); i <= inpNumbers2.size() - 1; i++) {
  26.                 outputNumbers.add(inpNumbers2.get(i));
  27.             }
  28.         }
  29.         if(inpNumbers2.size()<inpNumbers1.size())
  30.         {
  31.             for (int i = 0; i <= inpNumbers2.size() - 1; i++)
  32.             {
  33.                 outputNumbers.add(inpNumbers1.get(i));
  34.                 outputNumbers.add(inpNumbers2.get(i));
  35.             }
  36.             for (int i = inpNumbers2.size(); i <= inpNumbers1.size() - 1; i++)
  37.             {
  38.                 outputNumbers.add(inpNumbers1.get(i));
  39.             }
  40.         }
  41.         for(int j=0;j<=outputNumbers.size()-1;j++)
  42.         {
  43.             System.out.print(new DecimalFormat("0.###").format(outputNumbers.get(j)));
  44.             System.out.print(" ");
  45.         }
  46.     }
  47. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top