Hide

Problem H
Halting Helicopter

Whoah, that was quite the scare! Harjawaldar, a helicopter test pilot, did a miraculous save and managed to land the prototype helicopter with only minor damages.

Today’s test run was for the helicopter producer Beeswax Corp, which needed help verifying that their new prototype could reach its expected altitude. The entire helicopter stopped reacting to any input after a certain height, causing the helicopter to quickly lose both height and a bit of stability. Fortunately, Harjawaldar had prepared for that outcome and managed to regain enough stability and lift to avoid the worst.

Beeswax Corp was of course saddened by the results, but was happy that Harjawaldar could provide them with the data they needed. However, while it’s none of Harjawaldar’s beeswax, he experienced a similar incident in the past, so he dared to ask their CTO Ikaros a simple question:

“How’d you solve the icing problem?”
“Icing problem?” Ikaros replied

It turns out Ikaros is somewhat surprised that cold temperatures were a problem at high altitudes, and not heat. This isn’t surprising for the rest of the team, though they’re interested in the exact altitude where Harjawaldar experienced the system malfunction. Trouble is, they forgot to install an altimeter in the helicopter!

Fortunately, it is possible to dig this information out of the helicopter “crash” log, though it’s not easy. The altitude at any specific time $t$ is defined as

\[ h(t) = \left(\sum _{i=1}^{N-1} c_ it^ i\right) - c_ Nt^ N \]

Higher-order polynomials aren’t Harjawaldar’s strong suit, so he has called you for help. Can you find the time $h(t)$ is the highest? Harjawaldar is able to compute $h(t)$ himself, as long as he knows what $t$ is.

Input

The first line contains a single integer $N$, the degree of the expression. On the next line, $N$ integers $c_1, \ldots c_ N$ follow, representing the coefficients for the terms $c_ it^ i$.

Output

Output the value $0 \leq t$ which maximises $h(t)$. Your answer must have an absolute or relative error of at most $10^{-8}$.

Limits

  • $1 < N \leq 10$

  • $0 < c_ i \leq 100$

Sample Input 1 Sample Output 1
2
1 1
0.5
Sample Input 2 Sample Output 2
3
1 2 3
0.62283903

Please log in to submit a solution to this problem

Log in