eolymp
bolt
Try our new interface for solving problems
Məsələlər

Stacking Curvy Blocks

Stacking Curvy Blocks

You’re doing some construction work, and, to save money, you’re using some discount, "irregular" construction materials. In particular, you have some blocks that are mostly rectangular, but with one edge that’s curvy. As illustrated below, you’re going to use these irregular blocks between stacks of ordinary blocks, so they won’t shift sideways or rotate. You’ll put one irregular block on the bottom, with its curvy edge pointing up, and another above it, with it’s curvy edge pointing down. You just need to know how well these blocks fit together. You define the fit quality as the maximum vertical gap between the upper edge of the bottom block and the lower edge of the top block when the upper block is just touching the lower one. \includegraphics{https://static.e-olymp.com/content/b7/b7923a50104ce91a02f3883690e8fd3af5f77b0a.jpg} Figure 1: Block stacking and coordinate system All blocks are one unit wide. You’ve modeled the curvy edges as cubic polynomials, with the left edge of the block at \textbf{x = 0} and the right edge at \textbf{x = 1}. \InputFile Each test case is given on two lines, with each line containing four real numbers. The numbers on the first line, \textbf{b_0b_\{1 \}b_2} \textbf{b_3}, describe the shape of the upper edge of the bottom block. This edge is shaped just like the polynomial\textbf{b_0+b_1x+b_2x^2+b_3x^3} for \textbf{0} ≤ \textbf{x} ≤ \textbf{1}. The numbers on the next input line, \textbf{t_0} \textbf{t_1} \textbf{t_2} \textbf{t_3}, describe the bottom edge of the block that’s going on top. This edge is shaped just like the polynomial \textbf{t_0+t_1x+t_2x^2+t_3x^3} for \textbf{0} ≤ \textbf{x} ≤ \textbf{1}. No input value will have magnitude greater than \textbf{50000}. There are at most \textbf{500} test cases. Input ends at end of file. \OutputFile For each test case, print out a single line giving the fit quality. An answer is considered correct if its absolute or relative error is at most \textbf{10^\{−6\}}.
Zaman məhdudiyyəti 1 saniyə
Yaddaşı istafadə məhdudiyyəti 256 MiB
Giriş verilənləri #1
1.000000 -12.904762 40.476190 -28.571429
3.000000 11.607143 -34.424603 22.817460
2.000000 -10.845238 16.964286 -10.119048
3.000000 4.190476 -3.571429 2.380952
Çıxış verilənləri #1
4.396074
6.999999
Mənbə 2012 ACM-ICPC North American Qualification Contest