Саня пидор

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
double tern(Point a, Point b)
{
double l = 0;
double r = INF;
while (r - l > E)
{
double ml = (r + l) / 3 + l;
double mr = 2 * (l + r) / 3 + l;
if ( f(a, b, ml) > f(a, b, mr) )
l = ml;
else
r = mr;
}
return l;
}