Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import com.sun.org.apache.xpath.internal.SourceTree;
- import java.time.chrono.MinguoEra;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine());
- int sumL=0;
- int sumR=0;
- for (int i = 0; i < n ; i++) {
- int left = Integer.parseInt(scanner.nextLine());
- sumL += left;
- }
- for (int i = 0; i < n; i++) {
- int right = Integer.parseInt(scanner.nextLine());
- sumR += right;
- }
- int diff = Math.abs(sumL-sumR);
- if(diff!=0){
- System.out.println("No, diff " + diff);
- }else{
- System.out.println("Yes, sum " + sumL);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement