From 970efada900fcbfb8b2620b90a23604564f7a529 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sat, 26 Mar 2022 20:08:54 +0800 Subject: [PATCH] B - Mex https://atcoder.jp/contests/abc245/submissions/30437957 --- AtCoder/ABC245/B/B.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 AtCoder/ABC245/B/B.cpp diff --git a/AtCoder/ABC245/B/B.cpp b/AtCoder/ABC245/B/B.cpp new file mode 100644 index 00000000..1247c6db --- /dev/null +++ b/AtCoder/ABC245/B/B.cpp @@ -0,0 +1,27 @@ +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 2005; + +int n; +bool vis[N]; + +int main() { + std::ios::sync_with_stdio(false); + cin >> n; + for (int i = 1, x; i <= n; i++) { + cin >> x; + vis[x] = true; + } + for (int i = 0; i <= 2000; i++) { + if (!vis[i]) { + cout << i << endl; + exit(0); + } + } + return 0; +}