~/algor $ cat problems/matritsa-paskal-uchburchagi
Pascal's triangle
Medium
1000 ms
128 MB
61%
A positive integer $n$ is given. Print the first $n$ rows of Pascal's triangle. Row $i$ has $i$ numbers; the numbers at the edges are $1$, and every inner number is the sum of the two neighbours above it:
$$P_{i,j} = P_{i-1,j-1} + P_{i-1,j}$$
Input
One positive integer $n$.
Output
$n$ lines: line $i$ contains $i$ space-separated integers.
Note
$1 \le n \le 60$
Examples
Input #1
5
Output #1
1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
Input #2
1
Output #2
1