#C11814. Minimum Blocks Needed
Minimum Blocks Needed
Minimum Blocks Needed
You are given n buildings with respective heights. Your task is to compute the minimum number of blocks required to construct the skyline. The total number of blocks is simply the sum of the heights of all buildings. In mathematical terms, if the heights of the buildings are \(h_1, h_2, \dots, h_n\), then the answer is:
[ \text{Total Blocks} = \sum_{i=1}^{n} h_i ]
Use efficient input/output operations to read from stdin
and write the result to stdout
.
inputFormat
The input consists of two lines:
- The first line contains an integer \(n\) representing the number of buildings.
- The second line contains \(n\) space-separated integers \(h_1, h_2, \dots, h_n\) representing the heights of the buildings.
outputFormat
Output a single integer which is the minimum number of blocks needed to create the skyline.
## sample5
3 2 1 5 5
16