#include /** * @title Real solutions of quadratic equation * @docs quadratic_equation.md */ std::vector quadratic_equation(double a, double b, double c){ double d = b*b - 4*a*c; if(d < 0) return {}; double x1 = (-b - std::sqrt(d)) / (2 * a); double x2 = (-b + std::sqrt(d)) / (2 * a); return {x1, x2}; } namespace solver{ constexpr double eps = 1e-4; void solve(){ double a, b, c; std::cin >> a >> b >> c; auto ans = quadratic_equation(a, b, c); if(ans.empty()) std::cout << "imaginary" << "\n"; else{ std::cout << std::fixed << std::setprecision(12); if(std::abs(ans[0] - ans[1]) < eps) std::cout << ans[0] << "\n"; else{ std::cout << ans[0] << " " << ans[1] << "\n"; } } } } int main(){ solver::solve(); return 0; }