#K39622. Pyramid Block Count
Pyramid Block Count
Pyramid Block Count
In this problem, you are required to calculate the total number of blocks needed to build a pyramid with L levels. The pyramid is built such that the first level consists of 1 block, the second level consists of 2 blocks, and so on. The total number of blocks for a pyramid with L levels can be computed using the formula:
\(\frac{L(L+1)}{2}\)
Constraints: 1 \(\leq\) L \(\leq\) 1,000,000
You need to read the input from standard input and output the result to standard output.
inputFormat
The input consists of a single integer L representing the number of levels in the pyramid.
Example:
3
outputFormat
Output a single integer which is the total number of blocks required to build the pyramid.
Example:
6## sample
1
1
</p>