問題一覧 > 通常問題

No.1179 Quadratic Equation

レベル : / AI推定難易度 : 167 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 小数誤差許容問題 絶対誤差または相対誤差が $10^{-4}$ 以下。ただし、ジャッジ側の都合で500桁未満にしてください
タグ : (AC するまで非表示) / 解いたユーザー数 220
作問者 : okazakisteve / テスター : NatsubiSogan
お気に入りにしたユーザー ProblemId : 4811 / 自分の提出
問題文最終更新日: 2020-07-29 15:49:54
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 262 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。