liartie

Untitled

Oct 14th, 2022
1,339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <algorithm>
  4. #include <iterator>
  5. #include <vector>
  6.  
  7. using namespace std;
  8.  
  9. int main() {
  10.     int n;
  11.     cin>>n;
  12.     vector <int> v(n);
  13.     copy_n (istream_iterator <int> (cin), n, v.begin());
  14.     cout<<*find_if (v.begin(), v.end(), [v](int &el){
  15.         return count (v.begin(), v.end(), el) == 1;
  16.      });
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment