lower_bound

lower_bound
1.
temp=lower_bound(a+1,a+n+1,x)-b;
temp表示在数组a中第一个大于等于x的位置

2.
bool cmp(int a,int b){
return a>b;
}
temp=lower_bound(a+1,a+n+1,x,cmp)-b;
temp表示在数组a中第一个小于等于x的位置

3.
bool cmp(int a,int b){
return a>=b;
}
temp=lower_bound(a+1,a+n+1,x,cmp)-b;
temp表示在数组a中第一个小于x的位置

原文地址:https://www.cnblogs.com/war1111/p/11277002.html