跳到正文

题解

题解:P14130 【MX-X22-T1】「TPOI-4A」MEX Problem

New_Void约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 1 分钟
题目
P14130

版本

  1. v1当前

P14130 【MX-X22-T1】「TPOI-4A」MEX Problem

思路

从题面找到关键一句话:每个子序列的 mexmex 都不为 00。

所以直接统计 00 的个数即可。

Code

C++
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e5+5;
int a[N];
int cnt;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int n;cin>>n;
    for (int i=1;i<=n;i++){
        cin>>a[i];
        if (a[i]==0) cnt++;
    }
    cout<<cnt;
    return 0;
}
原文