結果

問題 No.955 ax^2+bx+c=0
ユーザー NyaanNyaanNyaanNyaan
提出日時 2021-01-03 23:57:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 765 bytes
コンパイル時間 716 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 85,504 KB
最終ジャッジ日時 2024-10-13 17:50:42
合計ジャッジ時間 13,082 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 122
権限があれば一括ダウンロードができます

ソースコード

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:
	from decimal import Decimal
	sq=Decimal(d).sqrt()
	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