#P1024. [NOIP 2001 提高组] 一元三次方程求解

    ID: 24 远端评测题 1000ms 125MiB 尝试: 0 已通過: 0 難度: 3 上傳者: 标签>数学2001二分NOIp 提高组枚举,暴力分治

[NOIP 2001 提高组] 一元三次方程求解

Description

Given a cubic equation of the form ax3+bx2+cx+d=0a x^3 + b x^2 + c x + d = 0. You are given the coefficients of the equation (where a,b,c,da, b, c, d are real numbers). It is guaranteed that the equation has three distinct real roots, the roots lie in the range 100-100 to 100100, and the absolute difference between any two roots is 1\ge 1. Output the three real roots in increasing order on a single line (separated by spaces), each to exactly 2 decimal places.

Hint: Let the equation be f(x)=0f(x) = 0. If there exist two numbers x1x_1 and x2x_2 with x1<x2x_1 < x_2 and f(x1)×f(x2)<0f(x_1) \times f(x_2) < 0, then there is a root in the interval (x1,x2)(x_1, x_2).

Input Format

One line containing 44 real numbers a,b,c,da, b, c, d.

Output Format

One line containing 33 real roots in increasing order, each to exactly 22 decimal places.

1 -5 -4 20

-2.00 2.00 5.00

Hint

  • If x1<x2x_1 < x_2 and f(x1)×f(x2)<0f(x_1) \times f(x_2) < 0, then there is a root in (x1,x2)(x_1, x_2).
  • Source: NOIP 2001 Senior, Problem 1.

Translated by ChatGPT 5