#include<stdio.h> #include<string.h> int main(){ int t; scanf("%d",&t); char a[1000]; for(int i=0;i<t;i++){ int n,ct=0; scanf("%d",&n); for(int j=0;j<n;j++){ scanf("%d",&a[j]); } for(int k=0;k<n;k++){ if(a[k]==2)ct++; } printf("%d\n",ct); } } |
Double click to view unformatted code.