Roots of Quadratic Equation
Basic Accuracy: 22.99% Submissions: 6362 Points: 1

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

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

Output: 
If roots of equations exists, 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
-103 <= a <= 103
-103 <= b <= 103
-103 <= c <= 103

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

Output:
1 1
4 3
Imaginary

Explanation:
Testcase 1:
Roots of equation x2 - 7x + 12 are 4 and 3.
Testcase 3: Roots of equation x2 + 4x + 8 are imaginary since it's discriminant is less than 0.

 

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.