int binarySerach(const vector<int>& v,const int& key){
int len=v.size();
int l=0,r=len-1,mid;
while (l<=r){
mid=(l+r)/2;
if(v[mid]==key)
return mid;
else if (v[mid]<key)
l=mid+1;
else
r=mid-1;
}
return -1;
}
蛋疼
int binarySerach(const vector<int>& v,const int& key){
int len=v.size();
int l=0,r=len-1,mid;
while (l<=r){
mid=(l+r)/2;
if(v[mid]==key)
return mid;
else if (v[mid]<key)
l=mid+1;
else
r=mid-1;
}
return -1;
}
蛋疼