class Solution {
public:
int searchInsert(vector<int>& nums, int target) {
int h=nums.size()-1,l=0;
if(nums[h]<target) return h+1;
while(l<h){
int m=(h-l)/2+l;//取 ceiling
if(nums[m]<target) l=m+1;
else h=m;
}
return l;
}
};