C++,codeforces,2049A,A. MEX Destruction

/*
codeforces,2049A,A. MEX Destruction

*/
#include <iostream>
void solve(){
    int n;
    std::cin>>n;
    bool a=true,b=true;
    int ans = 0;
    while(n--){
        int temp;
        std::cin>>temp;
        if(ans==2){
            while(n--){
                std::cin>>temp;
            }
            break;
        }
        b = temp==0;
        if(a==true && b==false){
            ans++;
        }
        a = b; 
    }
    std::cout<<ans<<std::endl;
}
int main(){
    int t;std::cin>>t;
    while(t--){
        solve();
    }
}
posted @ 2025-03-07 19:58  Kazuma_124  阅读(15)  评论(0)    收藏  举报