为什么注释掉的三分方式不能过
@大佬
题目来源:http://hihocoder.com/problemset/problem/1142?sid=1003381
貌似不是eps的问题
#include<cstdio>
#include<cmath>
#define eps 1e-4
using namespace std;
double a,b,c,x,y;
double l,r,p,mid1,mid2,k1,k2,ans1,ans2;
double f(double fx)
{
double fy=a*fx*fx+b*fx+c;
return sqrt((x-fx)*(x-fx)+(y-fy)*(y-fy));
}
int main()
{
scanf("%lf%lf%lf%lf%lf",&a,&b,&c,&x,&y);
l=-;r=;
while(r-l>eps)
{
//mid1=(2*l+r)/3;mid2=(l+2*r)/3;
//这种三分姿势不能过
mid1=(l+r)/;mid2=(mid1+r)/;
k1=f(mid1);k2=f(mid2);
if(k1<=k2) r=mid2;
else l=mid1;
}
printf("%.3lf",f(l));
return ;
}