View Code of Problem 3857

import  java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int t = scanner.nextInt();
		for(int i=0; i<t; i++) {
			int n = scanner.nextInt();
			int count = 0;
			for(int j=0; j<n; j++) {
				if(scanner.nextInt() == 2) {
					count++;
				}
			}
			System.out.println(count);
		}
	}
}

Double click to view unformatted code.


Back to problem 3857