穷举法
#include <iostream>
#include <unordered_set>
using namespace std;
int n;
unordered_set<int> s;
int main(void) {
cin >> n;
while (n--) {
int x;
cin >> x;
s.emplace(x);
}
for (int i = 1; i <= 1e5; ++i)
if (!s.count(i)) return printf("%d", i), 0;
return printf("%d", 100001), 0;
}
请问 s.emplace(x);是有什么作用?
== s.insert(x)