All submissions for this problem are available.
f(x) and g(x) are two quadratic polynomials:
- f(x) = Ax2 + Bx + C
- g(x) = Dx2 + Ex + F
It is guaranteed that f(x) and g(x) do not intersect. That is, there is no real number r, such that f(r) = g(r).
You need to find a quadratic polynomial h(x) = Px2 + Qx + R such that the sum of areas under the curves |f(x) - h(x)| and |g(x) - h(x)| is minimized between integer points x = L and x = R.
Output this minimized sum of the areas of curves |f(x) - h(x)| and |g(x) - h(x)| from x = L and x = R. Print this number as a fraction U/V, where U and V are positive integers and gcd( U, V) = 1.
- First line contains a single integer T - the total number of testcases.
Each testcase is described by 3 lines.
- The first line contains 3 space-separated integers A, B and C.
- The second line contains 3 space-separated integers D, E and F.
- The third line contains 2 space-separated integers L and R.
For each testcase, print a single line containing the sum of areas as the required fraction.
- 1 ≤ T ≤ 103
- 1 ≤ A, B, C, D, E, F ≤ 103
- -103 ≤ L ≤ R ≤ 103
- P, Q, R need to be real numbers.
Sample Input 1 1 1 1 2 2 2 -1 2 Sample Output 15/2
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY|
Fetching successful submissions
If you are still having problems, see a sample solution here.