#K46352. Minimum Container Height
Minimum Container Height
Minimum Container Height
This problem requires you to determine the minimum height of a container needed to accommodate a set of rectangular blocks. Each block is placed in its own layer (without overlapping) and the layers are stacked vertically. The container height is simply the sum of the heights of the individual blocks.
Formally, given n
blocks, where the height of the i-th block is \(h_i\), the minimum container height is computed as:
[ TotalHeight = \sum_{i=1}^{n} h_i ]
You will be provided with an integer n
(the number of blocks) followed by n
lines, each containing three integers representing the length, width, and height of a block, respectively. Your task is to print the required container height.
inputFormat
The input is read from standard input (stdin
) and has the following format:
n l1 w1 h1 l2 w2 h2 ... ln wn hn
Where:
n
: an integer representing the number of blocks.li, wi, hi
: three integers representing the length, width, and height of the i-th block.
outputFormat
The output, printed to standard output (stdout
), is a single integer representing the minimum container height which is the sum of the heights of all blocks.
1
1 1 1
1
</p>