| 2026 Fall UT CS104c Midterm #1 |
|---|
| Finished |
You are in charge of buying a pumpkin to carve into a jack-o'-lantern for your suite's Halloween decorations! After performing extensive research at the nearby supermarket, you've realized that the supermarket generally charges more for larger pumpkins, but the relationship is complicated: you've fit a cubic curve relating price $$$p$$$ of the pumpkin to its volume:
$$$$$$V(p) = a_0 p^3 + a_1 p^2 + a_2 p + a_3$$$$$$
for some positive constants $$$a_i$$$ you've calculated from the data.
A good-looking jack-o'-lantern must be carved from a pumpkin of volume at least $$$V_T$$$. Given $$$V_T$$$, what's the cheapest price you'll have to pay to acquire a sufficiently-large pumpkin?
The only line of input contains five space-separated real numbers $$$V_T$$$, $$$a_0$$$, $$$a_1$$$, $$$a_2$$$, and $$$a_3$$$. These numbers might be expressed in scientific notation (see sample inputs) and are all in the range $$$\left[ 10^{-9}, 10^9\right]$$$.
Print the smallest value of $$$p$$$ for which $$$V(p) \geq V_T$$$. Your answer will be judged correct if it differs from the judge's solution by absolute or relative error at most $$$10^{-6}$$$.
100.0 1.0 2.0 3.0 4.0
3.8137429654598236083984375
1e9 1e-9 1e-9 1e-9 1e-9
999999.666666418313980102539062
1.21419e-07 1571.28 12923.4 6.86914e+07 2.14303e+06
2.98023223876953125e-08
Hint: in order to satisfy the above error bound, be sure to print many digits of $$$p$$$ (at least 8).
For example, if your answer is stored in ans:
| Name |
|---|


