View Code of Problem 3857

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(){
    int t;
    scanf("%d",&t);
    while(t--){
        int n,cnt=0,num;
        scanf("%d",&n);
        for(int i=0;i<n;i++){
            scanf("%d",&num);
            if(num==2){
                cnt++;
            }
        }
        printf("%d\n",cnt);
    }
	return 0;
}

Double click to view unformatted code.


Back to problem 3857