跳到正文

题解

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

小屹0_0约 1 分钟
原文

这是 2025年10月2日 存档的第 1 版,不是当前版本。查看当前版本

文章信息与版本

文章信息

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

版本

  1. v2当前
  2. v1

统计 0 的个数即可,易证显然。

AC code
C++
#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 5;

int n, cnt;

int main(){
    ios::sync_with_stdio(0), cin.tie(0);
    
    cin >> n;
    for (int i = 1; i <= n; i ++ ){
        int x; cin >> x;
        if (!x) cnt ++;
    }
    cout << cnt;
}