본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 26548번 Quadratics

by 현장 2024. 7. 6.

-Code

from math import sqrt

for _ in range(int(input())):
    a, b, c = map(float, input().split())
    res1 = (-b + sqrt(b ** 2 - 4 * a * c)) / (2 * a)
    res2 = (-b - sqrt(b ** 2 - 4 * a * c)) / (2 * a)
    print(f"{res1:.3f}, {res2:.3f}")