#206. 积木三角形总数(递归求解)
积木三角形总数(递归求解)
Block Triangle
Background
Dawei is playing with blocks. He enjoys building various shapes with them, and one of his favorites is a triangle.
Problem Description
We have a triangle made of blocks. The topmost row has block, the next row down has blocks, the next row has blocks, and so on. Compute recursively (no loops or multiplication) the total number of blocks in such a triangle with the given number of rows.
Input Format
Input is given from Standard Input in the following format.
rows
Output Format
Output is printed to Standard Output in the following format.
total_blocks
Sample
0
0
1
1
2
3
Sample Explanation
For rows, there are blocks in total. For row, there is block in total. For rows, there are blocks in total.
Constraints
Time limit: second, Memory limit: KiB for each test case.