二分专题
int p=lower_bound(A,A+n,x)-A; //查询>=x的第一个下标 int p=upper_bound(A,A+n,x)-A; //查询>x的第一个下标 int p=upper_bound(A,A+n,x)-A-1; //查询<=x的最后一个下标 int p=lower_bound(A,A+n,x)-A-1; //查询<x的最后一个下标 int n=upper_bound(A,A+n)-lower_bound(A,A+n); //查询等于x的数量