Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) throws InterruptedException {
- Scanner input = new Scanner(System.in);
- int n = Integer.parseInt(input.nextLine());
- int leftSum = 0;
- int rightSum = 0;
- for (int i = 0; i < n; i++) {
- int left = Integer.parseInt(input.nextLine());
- leftSum += left;
- }
- for (int i = 0; i < n; i++) {
- int right = Integer.parseInt(input.nextLine());
- rightSum += right;
- }
- int diff = Math.abs(leftSum - rightSum);
- if (!(diff == 0)) {
- System.out.println("No, diff = " + diff);
- } else {
- System.out.println("Yes, sum = " + leftSum);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment