結果

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

ソースコード

diff #

import numpy as np
a,b,c=map(int,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'>":
      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])))
  if b*b<4*a*c:
    print(0)
    exit()
  for i in range(len(x)-1,-1,-1):
    if str(type(x[i]))!="<class 'numpy.float64'>":
      x[i]=x[i].real
  x=sorted(set(x))
  print(len(x))
  if len(x):
    print(*x,sep='\n')
0