eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

The Golden Ceiling

The Golden Ceiling

The main office of the Bank of Zork was built in the Aragain Village(later known as Flatheadia)in the year 722 of the Great Underground Empire(GUE). In 788 GUE,the chairman, J.Pierpont Flathead, decided(shortly before his unexplained disappearance in 789), that it was time to completely redesign the already ornate bank atrium with a ceiling covered in brilliant gold leaf. This new ceiling was not your ordinary ceiling. Although the atrium is essentially a big box,the ceiling would be slanted(supposedly,making the atrium look bigger). At the time,the exact dimensions of the rectangular atrium and the slope and location of the slanted ceiling had not been finalized. Flathead wanted to know how much gold leaf he would have to order from the Frobozz Magic Gold Leaf Company to cover the ceiling for different atrium dimensions and ceiling slants. He also wanted to allow the slanted part to possibly hit the floor of the box and/or the top of the box. Consider the following rough sketches of some possibly atrium configurations: \includegraphics{https://static.e-olymp.com/content/2b/2b4c2c20b18ef80fba0c1db12ad2451d2d7d1e60.jpg} Note: The dashed outline represents the original box,the horizontally ruled surface is the slanted part of the ceiling and the cross hatched surface is the part of the top of the box not cut off by the plane. The walls and floor of the atrium are transparent.The total area to be covered(the ceiling)is the slanted part plus any part of the top of the original box that is not cut off by the plane. Your job is to write a program that Flathead could have used to calculate the amount gold leaf required to cover the ceiling for a particular configuration. As a sad epilogue,the main branch was brought to ruins when the Curse of Megaboz befell it in 883GUE. Between the barbarian invasions of the 880's and the countless looters that had tread the underground ruins in the year that followed, the entire bank with all its valuables, as well as its very expensive gold leaf ceiling, had been removed or vandalized. More information can be found on-line at: \href{http://www.thezorklibrary.com/history/bank_of_zork.html}{http://www.thezorklibrary.com/history/bank_of_zork.html}. \InputFile The first line of input contains a single integer \textbf{P} (\textbf{1} ≤ \textbf{P} ≤ \textbf{1000}), which is the number of data sets that follow. Each data set is a single line that contains the data set number,N,followed by a space, followed by seven space separated double precision floating point values, \textbf{L}, \textbf{W}, \textbf{H}, \textbf{A}, \textbf{B}, \textbf{C} and \textbf{D}. The values \textbf{L}, \textbf{W} and \textbf{H} specify the length, width and height of the atrium in Flathead Units(FU's), respectively, and are always positive values. The values \textbf{A}, \textbf{B}, \textbf{C} and \textbf{D} specify the coefficients of the plane equation for the slanted part of the ceiling: \textbf{Ax + By + Cz = D} where: \textbf{0} ≤ \textbf{x} ≤ \textbf{L}, \textbf{0} ≤ \textbf{y} ≤ \textbf{W}, \textbf{0} ≤ \textbf{z} ≤ \textbf{H}. One corner of the original box is always at the origin (\textbf{0}, \textbf{0}, \textbf{0}) and the other at (\textbf{L}, \textbf{W}, \textbf{H}). The plane will never be vertical(\textbf{C} will be ≥ \textbf{1.0})and the plane will always pass through the interior of the box (there will be points (\textbf{x}, \textbf{y}, \textbf{z}) in the box and strictly above the plane \textbf{(Ax+By+Cz>D)}).and others strictly below the plane \textbf{(Ax+By+Cz.} \OutputFile For each data set there is one line of output. It contains the data set number (\textbf{N}) followed by a single space, followed by an integer value that is the number of square FU's required to cover the ceiling in gold leaf (rounded up to the next square FU)\textbf{.}
Ліміт часу 1 секунда
Ліміт використання пам'яті 64 MiB
Вхідні дані #1
3
1 10 12 15 -1.3 1 1.1 3.5
2 10 12 10 -1.3 1 1.1 11
3 13 9 10 -1.3 1 1.1 0
Вихідні дані #1
1 166
2 164
3 144
Джерело 2011 Greater New York Regional