結果

問題 No.1179 Quadratic Equation
ユーザー chineristACchineristAC
提出日時 2020-08-21 22:58:43
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 269 bytes
コンパイル時間 385 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 71,660 KB
最終ジャッジ日時 2023-08-05 08:38:13
合計ジャッジ時間 2,413 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,228 KB
testcase_01 AC 76 ms
71,660 KB
testcase_02 AC 73 ms
71,468 KB
testcase_03 AC 73 ms
71,320 KB
testcase_04 AC 74 ms
71,264 KB
testcase_05 AC 72 ms
71,456 KB
testcase_06 AC 72 ms
71,540 KB
testcase_07 AC 72 ms
71,352 KB
testcase_08 AC 71 ms
71,448 KB
testcase_09 AC 74 ms
71,444 KB
testcase_10 AC 74 ms
71,360 KB
testcase_11 AC 76 ms
71,392 KB
testcase_12 AC 71 ms
71,508 KB
testcase_13 AC 70 ms
71,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt

a,b,c=map(int,input().split())

if b**2-4*a*c<0:
    print("imaginary")
elif b**2-4*a*c==0:
    print(-b/(2*a))
else:
    p1=-b+sqrt(b**2-4*a*c)
    p2=-b-sqrt(b**2-4*a*c)
    q=2*a
    ans1,ans2=p1/q,p2/q
    print(min(ans1,ans2),max(ans1,ans2))
0