#K65467. Skyline Area
Skyline Area
Skyline Area
Given a list of building heights, your task is to compute the total area covered by the skyline silhouette. The total area (A) is defined as the sum of all building heights: [ A = \sum_{i=1}^{n} h_i ] where (h_i) represents the height of the (i)-th building. If there are no buildings, the area is 0. Note that the buildings are assumed to be adjacent with a width of 1 unit each.
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 representing the heights of the buildings. If (n = 0), the second line may be empty.
outputFormat
Output a single integer representing the total skyline area (i.e. the sum of all building heights).## sample
6
3 0 0 2 0 4
9