#include #ifdef DEBUG #include #else #define dump(...) #endif /** * @title 二次方程式の実数解 * @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); if(d == 0) return {x1}; double x2 = (-b - std::sqrt(d)) / (2 * a); return {x1, x2}; } int main(){ int a, b, c, d; while(std::cin >> a >> b >> c >> d){ auto res = quadratic_equation(2.0, a-c, b-d); dump(res); if(res.size() == 0){ std::cout << "No\n"; }else if(res.size() == 1){ std::cout << "Yes\n"; }else{ auto x1 = res[0], x2 = res[1]; auto y1 = x1 * x1 + x1 * a + b; auto y2 = x2 * x2 + x2 * a + b; auto p = (y2 - y1) / (x2 - x1); p = std::abs(p); auto q = y1 - p * x1; std::cout << std::fixed << std::setprecision(12) << p << " " << q << "\n"; } } return 0; }