|
|
back to boardWhy this isn't working? Java. Posted by koti4 23 Feb 2021 20:23 import java.util.*; public class Main { public static void main(String[] args) { ArrayList<Integer> mas = new ArrayList<>(); Scanner input = new Scanner(System.in); int n,bin,delta = 0; n = input.nextInt(); for (int i = 0; i <n;i++){ bin = input.nextInt(); mas.add(bin); } n = input.nextInt(); for (int i = 0; i <n;i++){ bin = input.nextInt(); mas.add(bin); } n = input.nextInt(); for (int i = 0; i <n;i++){ bin = input.nextInt(); mas.add(bin); } Collections.sort(mas); delta = mas.size(); for (int i = 0;i<mas.size()-1;i++){ bin = mas.get(i); delta = delta - (mas.lastIndexOf(bin)-mas.indexOf(bin)+1); } delta = -1*delta-mas.size(); System.out.print(delta); } } |
|
|