Roots of Quadratic Equation
Submissions: 2321   Accuracy:

19.82%

  Difficulty: School   Marks: 0
*School Problem's Submission isn't counted in score!
     

Given a quadratic equation in the form ax2 + bx + c, find floor of roots of it.  For example floor of 5.6 is 5.

Input: 
First line contains an integer, the number of test cases T. Each test case should contain three positive numbers a,b and c.

Output: 
If roots of equations exits, then print the two roots separated by space (Higher valued root should be printed before lower valued). Else if a = 0, then print "Invalid" as equation is not quadratic.  If roots are imaginary, then print "Imaginary"

Constraints:
1<=T<=50
1<=a<=1000
1<=b<=1000
1<=c<=1000

Example:
Input:
3
1 -2 1
1 -7 12
1 4 8

Output:
1 1
4 3
Imaginary

** For More Input/Output Examples Use 'Expected Output' option **

Author: kartik


Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.