Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int a[111],n,x; // массив конечно отсортирован
- int main(){
- cin>>n>>x;
- for (int i=0;i<n;i++) cin>>a[i];
- cout<<"Наименьший, больший либо равный "<<x<<" - "<<*lower_bound(a,a+n,x)<<endl;
- cout<<"Его номер - "<<lower_bound(a,a+n,x)-a;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment