This page is still under construction.

Parts of this page are still being built. What you see may change.

Quadratics

Time limit1sMemory limit1024 MB

Summary
For each data set, read the coefficients a, b, c of a quadratic equation and print both real roots rounded to the thousandths place.
Level

Easy2 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

After hearing that the quadratic formula is used constantly in calculus, you decide it would be more efficient to write a program for it. Write a program that solves the equation shown below:

x=−b±b2−4ac2ax = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

The ±\pm sign represents two equations, one with ++ and one with −-. Your answer is both solutions, separated by a comma and a space.

Input

The first line contains a single integer nn, the number of data sets. Each of the following data sets is on its own line and contains three numbers aa, bb, and cc in that order. Each number is an integer or a decimal.

Output

Print both solutions rounded to the thousandths place, separated by a comma and one space. The solution for ++ comes first, and the solution for −- comes second. The solutions are always real numbers.

Examples1

  1. Example 1

    Input
    2
    1 6 3
    4 10 6.1
    
    Expected output
    -0.551, -5.449
    -1.056, -1.444