結果

問題 No.955 ax^2+bx+c=0
ユーザー NyaanNyaan
提出日時 2021-01-03 23:48:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 728 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 81,888 KB
実行使用メモリ 55,936 KB
最終ジャッジ日時 2024-10-13 17:41:50
合計ジャッジ時間 8,374 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 97 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from functools import lru_cache
from bisect import bisect_left as lb, bisect_right as ub
from collections import deque, defaultdict
from heapq import heapify, heappop, heappush
from math import gcd, ceil, sqrt
rd = lambda: sys.stdin.readline()
rdm = lambda: map(int, sys.stdin.readline().split())
rdl = lambda: list(map(int, sys.stdin.readline().split()))
inf = 2 * 10 ** 18
sys.setrecursionlimit(10 ** 7)
rg = range
wt = print
mk2d = lambda n,m: [[0]*m for i in range(n)]

a,b,c=rdm()
if a==0:
	if b==0:
		wt(-1 if c==0 else 0)
	else:
		wt(1)
		wt(-c/b)
	exit()

d=b*b-4*a*c
if d>0:
	sq = sqrt(d)
	wt(2)
	x = (-b+sq)/(2*a)
	y = (-b-sq)/(2*a)
	if x>y:x,y=y,x
	wt(x)
	wt(y)
elif d==0:
	wt(1)
	wt(-b/(2*a))
else:
	wt(0)
0