結果

問題 No.955 ax^2+bx+c=0
ユーザー StarMatyan
提出日時 2020-11-28 16:52:20
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 705 bytes
コンパイル時間 410 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-09-12 23:16:05
合計ジャッジ時間 6,848 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 24 WA * 98
権限があれば一括ダウンロードができます

ソースコード

diff #

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

hantei = 0
left_num = int(math.pow(b,2))
right_num = int(4*a*c)
a_bunbo=int(2*a)


if a==0 and b==0 and c==0:
	hantei = -1
elif a==0 and b==0 and not(c==0):
	hantei = 0
elif a==0 and not(b==0):
	hantei ==1
else:
	hantei ==2

if hantei ==-1:
	print(-1)
elif hantei ==0:
	print(0)
elif hantei ==1:
	print(1)
	if c==0:
		if b>0:
			print(0)
		elif b <0:
			print(-0)
	if not(c==0):
		print(round(c/b,18))
else:
	if left_num== right_num:
		print(1)
		print(round(-b/a_bunbo,18))
	elif left_num> right_num:
		print(2)
		print(round(-(b+math.sqrt(left_num- right_num))/a_bunbo,18))
		print(round(-(b-math.sqrt(left_num- right_num))/a_bunbo,18))
	else:
		print(0)
0