Problem H
A Night To Remember
Languages
en
is
where $a, b, c, d$ are coefficients that change from day to day. This poses a problem as there is an agreement that the pizza should be ready at time $T$, so when should it be ordered? Despite having decent resources ICPS can not place an order in the past. The decision to order pizza was made at time $t = 0$.
Input
The first line of the input contains one floating point number $0 \leq T \leq 10^9$ which has at most six digits after the decimal. This is the time that ICPS wants the pizza to be ready at. The next line contains four floating point numbers $0 \leq a, b, c, d \leq 10^3$ which also have at most six digits after the decimal. These coefficients determine the waiting time function as given above.
Output
If there exists no time $t$ such that the pizza is ready at time $T$, print ‘O nei!’. Otherwise print one line with the number $t$, the time such that if an order is placed at time $t$ it is ready at time $T$. If there is more than one such time $t$, print the smallest positive valid $t$. An answer is correct if its relative or absolute error is smaller than $10^{-6}$.
Sample Input 1 | Sample Output 1 |
---|---|
2.0 0.0 0.0 0.0 1.0 |
0.5591153088522895 |
Sample Input 2 | Sample Output 2 |
---|---|
2.0 2.0 1.0 1.0 1.0 |
O nei! |