|
|
back to boardtime limit ex... WA test 7, Why??? Posted by Garik 12 Oct 2014 03:56 import java.util.Scanner; import java.util.Collections; import java.util.ArrayList; public class Timus{ public static void main(String[] args){
Scanner in = new Scanner(System.in); ArrayList<Integer> arr = new ArrayList<Integer>(); int n = in.nextInt(); for (int i = 0; i< n; ++i){ arr.add(in.nextInt()); } int b = in.nextInt(); for (int i = 0; i< b; ++i){ arr.add(in.nextInt()); } b = in.nextInt(); for (int i = 0; i< b; ++i){ arr.add(in.nextInt()); } int sum=0; int occurrences = 0; for(int j =0; j<n; ++j){ occurrences = Collections.frequency(arr, arr.get(j)); if (occurrences % 3 == 0){ sum = sum + occurrences; } }
System.out.print(sum/3);
} } |
|
|