No.1179 Quadratic Equation
タグ : / 解いたユーザー数 220
作問者 :
Problem Statement
Solve the quadratic equation $ax^2 + bx + c = 0$.
Input
$a$ $b$ $c$
All inputs are integers.
$-100 \leq a,b,c \leq 100$
$a \neq 0$
Output
Output all solutions of the quadratic equation on one line.
However, real solutions do not necessarily exist, so if imaginary solutions occur, output ”imaginary”.
Your answer is accepted if its absolute or relative error from the expected answer is at most $10^{-4}$.
If there are multiple solutions, output them separated by single-byte spaces in ascending order.
Print a newline at the end.
Sample
Sample 1
Input
1 2 -5
Output
-3.449489742783178 1.449489742783178
Sample 2
Input
1 -4 4
Output
2.000000000000000
This is a double root.
Sample 3
Input
1 3 4
Output
imaginary
The equation has no real solutions.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。