#C9477. Pascal's Triangle Rows

    ID: 53574 Type: Default 1000ms 256MiB

Pascal's Triangle Rows

Pascal's Triangle Rows

You are given an integer n and your task is to print the first n rows of Pascal's Triangle.

Pascal's Triangle is constructed as follows:

  • The first row is 1.
  • Each subsequent row starts and ends with 1 and each inner element is the sum of the two numbers directly above it.

In mathematical terms, the element in the n-th row and k-th column is given by:

$$T(n,k) = \binom{n-1}{k-1}$$

for 1 ≤ k ≤ n, with the convention that elements outside the boundary are considered 0.

If the input n is less than or equal to 0, the program should produce no output.

inputFormat

The input consists of a single integer n provided via stdin, where n represents the number of rows of Pascal's Triangle to generate.

outputFormat

Output the first n rows of Pascal's Triangle to stdout. Each row should be printed on a new line and the elements of a row should be separated by a single space. If n <= 0, do not output anything.

## sample
1
1

</p>