#K51122. K-th Row of Pascal's Triangle

    ID: 29018 Type: Default 1000ms 256MiB

K-th Row of Pascal's Triangle

K-th Row of Pascal's Triangle

Given a non-negative integer K (where K can be up to 30), compute the K-th row of Pascal's Triangle. The rows are 0-indexed, which means the 0-th row is [1].

The elements in the K-th row are the binomial coefficients given by the formula:

$$ C(K, i) = \frac{K!}{i!(K-i)!} $$

For example:

  • If K = 3, the output row is 1 3 3 1.
  • If K = 5, the output row is 1 5 10 10 5 1.

Your program should read the input from stdin and write the answer to stdout in the format described below.

inputFormat

Input is provided via standard input. It consists of a single line containing one non-negative integer K (0 ≤ K ≤ 30).

outputFormat

Output the K-th row of Pascal's Triangle to standard output. The numbers in the row should be printed in one line, separated by a single space.## sample

0
1