Tranvick

Untitled

Mar 10th, 2012
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int a[111],n,x; // массив конечно отсортирован
  6.  
  7. int main(){
  8.     cin>>n>>x;
  9.     for (int i=0;i<n;i++) cin>>a[i];
  10.     cout<<"Наименьший, больший либо равный "<<x<<" - "<<*lower_bound(a,a+n,x)<<endl;
  11.     cout<<"Его номер - "<<lower_bound(a,a+n,x)-a;
  12.     return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment