#C6797. Generate nth Row of Pascal's Triangle
Generate nth Row of Pascal's Triangle
Generate nth Row of Pascal's Triangle
In this problem, you are required to generate the nth row of Pascal's Triangle. Recall that Pascal’s Triangle is defined such that every element is the sum of the two elements directly above it. The kth element of the nth row can also be computed using the binomial coefficient, given by ( \binom{n}{k} = \frac{n!}{k!(n-k)!} ). Your task is to read an integer ( n ) from standard input and then output the nth row of Pascal's Triangle as a sequence of space-separated integers.
For example, if ( n = 4 ), the output should be:
1 4 6 4 1
Make sure to handle the input and output strictly through standard input and standard output.
inputFormat
The input consists of a single line containing one non-negative integer ( n ) where ( 0 \leq n \leq 10^4 ) (or within reasonable bounds for your implementation).
outputFormat
Output the nth row of Pascal's Triangle. The numbers in the row should be printed in order, separated by a single space.## sample
0
1