結果

問題 No.955 ax^2+bx+c=0
ユーザー tanimani364tanimani364
提出日時 2021-04-04 18:46:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 657 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 82,580 KB
実行使用メモリ 68,000 KB
最終ジャッジ日時 2024-12-28 01:57:13
合計ジャッジ時間 11,409 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 89 WA * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
#coding:utf-8

import math
import string
import random
import heapq
from sys import stdin
# import numpy as np
# from matplotlib import pyplot as plt

def D(a,b,c):
	return b*b-a*c*4

def main():
	read=stdin.readline

	#edit here!
	a,b,c=map(int,read().split())
	if a==0:
		if b==0:
			if c==0:
				print(-1)
			else:
				print(0)

		else:
			print(1)
			print(f"{-c/b:.30f}")
	else:
		if D(a,b,c)<0:
			print(0)
		elif D(a,b,c)==0:
			print(1)
			print(f"{-b/(a*2):.30f}")
		else:
			print(2)
			print(f"{(-b-math.sqrt(b*b-a*c*4))/(a*2):.30f}")
			print(f"{(-b+math.sqrt(b*b-a*c*4))/(a*2):.30f}")

if __name__ == '__main__':
	main()
0