結果

問題 No.1179 Quadratic Equation
ユーザー anagohirameanagohirame
提出日時 2020-08-21 22:59:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 264 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2024-04-23 06:21:22
合計ジャッジ時間 1,351 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
52,224 KB
testcase_01 AC 38 ms
52,156 KB
testcase_02 AC 39 ms
52,352 KB
testcase_03 AC 38 ms
52,224 KB
testcase_04 AC 38 ms
51,712 KB
testcase_05 AC 38 ms
51,840 KB
testcase_06 AC 38 ms
51,584 KB
testcase_07 AC 38 ms
52,096 KB
testcase_08 AC 39 ms
51,968 KB
testcase_09 AC 38 ms
51,584 KB
testcase_10 AC 42 ms
51,968 KB
testcase_11 AC 38 ms
51,840 KB
testcase_12 AC 39 ms
51,712 KB
testcase_13 AC 41 ms
51,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b, c = map(int, input().split())
if b*b < 4*a*c:
	print("imaginary")
elif b*b == 4*a*c:
	print(-b/a/2)
else:
	axis = -b/a/2
	l, r = axis, 10**10
	for _ in range(50):
		x = (l+r)/2
		if (a*x*x + b*x + c > 0) ^ (a>0):
			l = x
		else:
			r = x
	print(2*axis-x, x)
0