luogu#P3382. 三分
三分
Background
This problem may have severe precision issues and can be hard to pass on some testdata. The testdata is relatively weak and is for reference only.
Problem Description
As stated, you are given an -th degree polynomial. It is guaranteed that within the interval there exists a point such that the function is monotonically increasing on and monotonically decreasing on . Find the value of .
Input Format
The first line contains a positive integer and two real numbers , as described above.
The second line contains real numbers, representing the coefficients of the -th degree polynomial from highest degree to lowest.
Output Format
Output one line containing a real number, which is the value of . Your answer is considered correct if it satisfies either of the following:
- Your answer has a relative or absolute error not exceeding compared to the standard answer .
- The function values corresponding to your answer and the standard answer, that is, and , have a relative or absolute error not exceeding .
3 -0.9981 0.5
1 -3 -3 1
-0.41421
Hint
For of the testdata, , the coefficients of the polynomial are in with up to decimal places, with up to decimal places, and .
Sample Explanation:

As shown in the figure, the red segment is the graph of the function on the interval .
When , the graph reaches its highest point, so the function is monotonically increasing on and monotonically decreasing on . Therefore , and the output is .
Translated by ChatGPT 5