二分法模板
while (l[HTML_REMOVED]>1;
if (a[mid]>=x) r = mid; //a[mid]满足条件,因此左边界一定在mid,左边,边界修改为[L,MID]
else l = mid + 1;
}
l = 0, r = n-1;
while (l[HTML_REMOVED]>1;
if (a[mid]<=x) l = mid;
else r = mid - 1;
}
//记忆方法 第一种模板适用于寻找左边界, 第二种适合有边界,当出现l = mid时候,mid = l + r +1 >>1;