Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.Arrays;
- class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int[] arr = Arrays
- .stream(scanner.nextLine().split(" "))
- .mapToInt(Integer::parseInt)
- .toArray();
- int[] sumArr = new int[arr.length / 2];
- for (int j = 0; j < arr.length / 4; j++) {
- sumArr[j] = arr[arr.length / 4 - (1 + j)] + arr[arr.length / 4 + j];
- sumArr[sumArr.length / 2 + j] = arr[arr.length / 2 + j] + arr[arr.length - (1 + j)];
- }
- for (int element : sumArr) {
- System.out.printf("%d ", element);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement