C++二分标准模板:
二分查找
http://www.nowcoder.com/questionTerminal/7bc4a1c7c371425d9faa9d1b511fe193
C++二分标准模板
class Solution { public: int upper_bound_(int n, int v, vector<int>& a) { int l = 0, r = n; while(l < r) { int mid = l + r >> 1; if(a[mid] < v) l = mid + 1; else r = mid; } return l + 1; } };