View Code of Problem 3857

#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int main(void)
{
    int t, n;
    cin >> t;
    while(t--){
        cin >> n;
        int tmp;
        int cnt = 0;
        while(n--){
            cin >> tmp;
            if(tmp == 2)
                cnt++;
        }
        cout << cnt << endl;
    }
}

Double click to view unformatted code.


Back to problem 3857