Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.*;
- import java.lang.*;
- import java.math.*;
- public class Boot {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int linesCount = Integer.parseInt(scan.nextLine());
- int[] firstArr = new int[linesCount];
- int[] secondArr = new int[linesCount];
- for (int i = 0; i < linesCount; i++)
- {
- int[] numbers = Arrays.stream(scan.nextLine().split(" "))
- .mapToInt(e -> Integer.parseInt(e)).toArray();
- if (i % 2 == 0)
- {
- firstArr[i] = numbers[0];
- secondArr[i] = numbers[1];
- }
- else
- {
- firstArr[i] = numbers[1];
- secondArr[i] = numbers[0];
- }
- }
- System.out.print(firstArr + " ");
- System.out.print(secondArr + " ");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement