|
|
back to boardWrong answer in Java 1.7 test 4 please help me import java.util.ArrayList; import java.util.Scanner; public class _1617 { public static void main(String[] args) throws Exception { Scanner s = new Scanner(System.in); ArrayList<Integer> list = new ArrayList<Integer>(); int n, i, count1 = 0, count2 = 0; n = s.nextInt(); int[] res = new int[n]; for (i = 0; i < n; i++) { res[i] = s.nextInt(); list.add(res[i]); } int e = 0; for (i = 0; i < list.size(); i++) { if (list.get(e).equals(res[i])) { count1++; if (count1 == 4) { count2++; } } } System.out.println(count2); } } |
|
|