結果

問題 No.955 ax^2+bx+c=0
ユーザー googol_S0
提出日時 2021-01-03 19:57:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 693 bytes
コンパイル時間 319 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 45,532 KB
最終ジャッジ日時 2024-10-13 14:07:16
合計ジャッジ時間 61,368 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 116 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
EPS=1e-8
a,b,c=map(lambda x:int(x)*(10**18),input().split())
if a==b==0:
  if c:
    print(0)
  else:
    print(-1)
elif a==0:
  x=sorted(set(np.roots([b,c])))
  for i in range(len(x)-1,-1,-1):
    if str(type(x[i]))!="<class 'numpy.float64'>":
      if abs(x[i].imag)>EPS:
        del x[i]
      else:
        x[i]=x[i].real
  x=sorted(set(x))
  print(len(x))
  if len(x):
    print(*x,sep='\n')
else:
  x=sorted(set(np.roots([a,b,c])))
  for i in range(len(x)-1,-1,-1):
    if str(type(x[i]))!="<class 'numpy.float64'>":
      if abs(x[i].imag)>EPS:
        del x[i]
      else:
        x[i]=x[i].real
  x=sorted(set(x))
  print(len(x))
  if len(x):
    print(*x,sep='\n')
0