結果

問題 No.1179 Quadratic Equation
ユーザー chielochielo
提出日時 2020-08-21 22:07:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 272 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 82,596 KB
実行使用メモリ 53,756 KB
最終ジャッジ日時 2024-04-23 05:54:55
合計ジャッジ時間 1,198 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,556 KB
testcase_01 AC 34 ms
52,600 KB
testcase_02 AC 34 ms
52,364 KB
testcase_03 AC 32 ms
52,320 KB
testcase_04 AC 33 ms
53,436 KB
testcase_05 AC 32 ms
52,828 KB
testcase_06 AC 33 ms
52,872 KB
testcase_07 AC 32 ms
52,716 KB
testcase_08 AC 32 ms
53,524 KB
testcase_09 AC 33 ms
52,576 KB
testcase_10 AC 32 ms
53,756 KB
testcase_11 AC 32 ms
52,944 KB
testcase_12 AC 33 ms
52,604 KB
testcase_13 AC 33 ms
52,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b, c = map(int, input().split())
d = b ** 2 - 4 * a * c
if d < 0:
    print('imaginary')
elif d == 0:
    x = -b / (2 * a)
    print(x)
else:
    x0 = (-b + d ** 0.5) / (2 * a)
    x1 = (-b - d ** 0.5) / (2 * a)
    if x0 > x1:
        x0, x1 = x1, x0
    print(x0, x1)
0