//查找第一次出现的位置 int search(int a[], int t){ int r = n - 1, l = 0; //cout << r << " " << l << "--" << mid << endl; while(l < r){ int mid = l + r >> 1; if (a[mid] >= t) r = mid; else l = mid + 1; } return l; }