結果

問題 No.1179 Quadratic Equation
ユーザー persimmon-persimmon
提出日時 2021-06-14 12:48:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 201 ms
コンパイル使用メモリ 82,152 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2024-12-24 07:38:18
合計ジャッジ時間 1,625 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

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