Josif_tepe

Untitled

Nov 5th, 2025
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. //#include <bits/stdc++.h>
  4. using namespace std;
  5.  
  6. const int maxn = 1e5 + 10;
  7.  
  8. int main()
  9. {
  10.     int n, x;
  11.     cin >> n >> x;
  12.    
  13.     int a[n];
  14.    
  15.     for(int i = 0; i < n; i++) {
  16.         cin >> a[i];
  17.     }
  18.    
  19.     int idx = lower_bound(a, a + n, x) - a;
  20.    
  21.     if(idx >= 0 and idx < n) {
  22.         cout << idx << endl;
  23.     }
  24.     else {
  25.         cout << "Ne postoi " << endl;
  26.     }
  27.    
  28.    
  29.    
  30.    
  31.      return 0;
  32. }
  33.  
  34.  
Advertisement
Add Comment
Please, Sign In to add comment