#include<bits/stdc++.h> using namespace std; int main(){ int n,t; cin>>n; while(n--){ int a[1005] = { }; cin>>t; for(int i = 0;i < t;i++)cin>>a[i]; sort(a,a+t); int num = 0; for(int i = 0;i<t;i++){ if(a[i]>2)break; else if(a[i] == 2)num++; } cout<<num<<endl; } return 0; } |
Double click to view unformatted code.