返回你要搜到的数组的下标的下一位
(区间是左闭右开的呀,返回那个开区间的坐标)
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
int a[5]={1,2,3};
int x=lower_bound(a,a+4,6)-a;
printf("%d
",x);
return 0;
}
返回值
4
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
int a[5]={1,2,3};
int x=upper_bound(a,a+4,6)-a;
printf("%d
",x);
return 0;
}
返回值
4