Problems > A Row of Pascal's Triangle

A Row of Pascal's Triangle

Difficulty: 1300 3000 ms 128 MB

math combinatorics

Print row N of Pascal's triangle (row 0 is 1), each entry modulo 109+7.

Input: one integer N.

Output: the N+1 entries C(N,0) ... C(N,N) mod 109+7.

Constraints:

  • 0 ≤ N ≤ 105

Sample Tests

Input 1
4
Output 1
1 4 6 4 1
Input 2
0
Output 2
1

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.