結果

問題 No.1179 Quadratic Equation
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-06-14 12:48:06
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 1,568 ms
コンパイル使用メモリ 86,720 KB
実行使用メモリ 71,444 KB
最終ジャッジ日時 2023-08-25 21:20:24
合計ジャッジ時間 2,582 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
70,844 KB
testcase_01 AC 71 ms
71,220 KB
testcase_02 AC 69 ms
71,112 KB
testcase_03 AC 69 ms
71,188 KB
testcase_04 AC 68 ms
71,200 KB
testcase_05 AC 70 ms
71,088 KB
testcase_06 AC 68 ms
71,172 KB
testcase_07 AC 68 ms
71,332 KB
testcase_08 AC 68 ms
71,424 KB
testcase_09 AC 68 ms
71,412 KB
testcase_10 AC 68 ms
71,288 KB
testcase_11 AC 68 ms
71,292 KB
testcase_12 AC 69 ms
71,120 KB
testcase_13 AC 69 ms
71,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a,b,c=map(int,input().split())
"""
ax**2+bx+c=0
a(x**2+b/ax+b**2/4*a**2)=-c+b**2/4*a
a(x+b/2*a)**2=-c+b**2/4*a
(x+b/2*a)**2=-c/a+b**2/4*a**2

"""
from math import sqrt
tmp=-c/a+b**2/(4*a**2)
if tmp<0:
  print("imaginary")
else:
  tmp=abs(sqrt(tmp))
  if tmp!=0:
    print(-tmp-b/(2*a),tmp-b/(2*a))
  else:
    print(-b/(2*a))

0