Josif_tepe

Untitled

Oct 1st, 2025
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <set>
  3. using namespace std;
  4.  
  5.  
  6. int main() {
  7.    
  8.     set<int> s;
  9.    
  10.     int n;
  11.     cin >> n;
  12.    
  13.     for(int i = 0; i < n; i++) {
  14.         int x;
  15.         cin >> x;
  16.        
  17.         s.insert(x);
  18.     }
  19.    
  20.     int x;
  21.     cin >> x;
  22.    
  23.    
  24.     set<int>::iterator it = s.lower_bound(x);
  25.    
  26.     if(it != s.end()) {
  27.         cout << *it << endl;
  28.     }
  29.     else {
  30.         cout << "NEMA TAKOV BROJ" << endl;
  31.     }
  32.    
  33.    
  34.     return 0;
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment