**Error Curves**

Josephina is a clever girl and addicted to machine learning recently. She pays much attention to a

*Method called Linear discriminant analysis, which have many interesting properties.*

In order to test the algorithm ' s e?ciency, she collects many datasets. What's more, each data is

Divided into and parts:training data and test data. She gets the parameters of the model on training

Data and test the model on test data.

To his surprise, she? NDS each DataSet ' s test error curve is just a parabolic curve. A Parabolic curve

Corresponds to a quadratic function. In mathematics, a quadratic function is a polynomial function of

The form f (x) = ax2 + bx + C. The quadratic would degrade to linear function if a = 0.

It's very easy to calculate the minimal error if there are only one Test error curve. However, there

is several datasets, which means Josephina would obtain many parabolic curves. Josephina wants to

Get the tuned parameters, the best performance in all datasets. So she should take the all error

Curves into account, i.e, she had to deal with many quadric functions and make a new error de?nition

To represent the total error. Now, she focuses on the following new function ' s minimal which related to

Multiple quadric functions.

The new function F (x) is de?ned as follow:

F (x) = Max (Si (x)), i = 1. . . N. The domain of x is [0,1000]. Si (x) is a quadric function.

Josephina wonders the minimum of F (x). Unfortunately, it ' s too hard for her and solve this problem.

As a super programmer, can you help her?

**Input**

The input contains multiple test cases. The. RST line is the number of cases T (T < 100). Each case

Begins with a number n (n≤10000). Following n lines, each line contains three integers a (0≤a≤100),

B (|b|≤5000), C (|c|≤5000), which mean the corresponding coe?cients of a quadratic function.

Output

For each test case, the output of the answer in a line. Round to 4 digits after the decimal point.

**Sample Input**

2

1

2 0 0

2

2 0 0

2-4 2

**Sample Output**

0.0000

0.5000

**Test Instructions **:

Given n two times curve S (x), define F (x) =max (Si (x)) to find the minimum value of f (x) on 0~1000.

**Exercises**

Three-point basic problem, three-point convex.

#include <iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespacestd; typedefLong Longll;Const intN =10000+Ten;intT,a[n],b[n],c[n],n;DoubleFDoublex) {DoubleAns = a[1] * x * x + b[1] * x + c[1]; for(inti =1; I <= N; i++) {ans= Max (ans, a[i] * x * x + b[i] * x +C[i]); } returnans;}DoubleThree_search (DoubleLDoubler) { for(inti =0; I < -; i++) { DoubleMID = L + (r-l)/3; DoubleMid2 = R-(r-l)/3; if(f (Mid) > F (mid2)) L =mid; ElseR =Mid2; } returnf (l);}intMain () {scanf ("%d",&T); while(t--) {scanf ("%d",&N); for(inti =1; I <= N; i++) scanf ("%d%d%d",&a[i],&b[i],&C[i]); DoubleAns = three_search (0, +); printf ("%.4f\n", ans); } return 0;}

UVA-1476 Error Curves three points