View Code of Problem 3857

#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		int n;
		cin >> n;
		int arr[1001];
		for (int i = 0; i < n; i++) {
			cin >> arr[i];
		}
		int count = 0;
		for (int i = 0; i < n; i++) {
			if (arr[i] == 2)count++;
		}
		cout << count << endl;
	}

	return 0;
}

Double click to view unformatted code.


Back to problem 3857