eolymp
bolt
Try our new interface for solving problems
Problems

Acceleration

Acceleration

Imagine a \textbf{1-D} coordinate system. Bob is at the origin at time \textbf{t} = \textbf{0}. Bob wants to go to point \textbf{X} (\textbf{X} > \textbf{0}) in his car. At each point with coordinate \textbf{x} (except the origin) there is a force equal to a given function \textbf{F}(\textbf{x}) which pushes him towards origin. Assuming his car have unit mass, what is the minimum value of acceleration his car needs to be able to travel to point \textbf{X}. Please output the infimum of set of acceleration values, which will enable Bob to travel to point \textbf{X}. The infimum of a set \textbf{A }of numbers is the upper bound on values of all real numbers \textbf{y} such that: \textbf{y} < \textbf{x} ∀ \textbf{x} ∈ \textbf{A} Also note that, Bob always tries to go towards point \textbf{X} from the origin. He never tries to go towards negative side of the coordinate axis and come back. For the purpose, the function \textbf{F}(\textbf{x}) is a polynomial in \textbf{x}. \InputFile First line contains \textbf{T}, the number of test cases. For each test case, the first line contains \textbf{N}; the degree of polynomial \textbf{F}(\textbf{x}) and \textbf{X} the target coordinate where Bob wants to go. Next line contains \textbf{N} + 1 space separated real numbers, \textbf{i}-th number referring to the coefficient of \textbf{x^i} in \textbf{F}(\textbf{x}) for \textbf{0} ≤ \textbf{i} ≤ \textbf{N}. It is known that \textbf{1} ≤ \textbf{T} ≤ \textbf{10000}, 0 ≤ \textbf{N} ≤ 5, 0 < \textbf{X} ≤ \textbf{10}, \textbf{0} ≤ coefficients ≤ \textbf{1}. \OutputFile Output contains \textbf{T} lines, each containing the infimum of set of acceleration values for the corresponding test case. Please output the value, rounded to 3 decimal places.
Time limit 1 second
Memory limit 64 MiB
Input example #1
1 
0 1.000 
1.000 
Output example #1
1.000

Example description: Any acceleration more than 1.0 will be enough to counter the constant force towards origin and Bob can reach his destination.

Author Аjay Somani
Source Sevastopol - 2010