模板:
int l,r;
while(l<r)
{
int mid=l+r>>1;
if(q[mid]>=x)r=mid;
else l=mid+1;
}
int l,r;
while(l<r)
{
int mid=l+r+1>>1;
if(q[mid]<=x)l=mid;
else r=mid-1;
}
double l,r;
while(abs(r-l)>eps)
{
double mid=(l+r)/2;
if(mid*mid*mid>=n)r=mid;
else l=mid;
}