题解 | #序列找数#
序列找数
https://www.nowcoder.com/practice/a7d1856a72404ea69fdfb5786d65539c
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int a, b; vector<int> v; while (cin >> a ) { for (int i=0;i<a;i++) { cin>>b; v.push_back(b); } sort(v.begin(),v.end()); for (int i=0;i<a;i++) { if(v[i]!=i){ cout << i << endl; break; } } } }