Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Pascal's Triangle

Limits 1s, 512 MB

Given an integer N, print the sum of the Nth row of the Pascal’s triangle.

In mathematics, Pascal’s triangle is a triangular array of the binomial coefficients. Below are the first few rows of the Pascal’s triangle:

                    1
                1       1
            1       2       1
        1       3       3      1
    1       4       6      4      1
1       5      10      10      5      1

The numbers on the edges of the triangle are always 1. Each of the remaining numbers are the sum of the two numbers that appear immediately above it.

The sum of the 5th row, for example, is $ 1 + 4 + 6 + 4 + 1 = 16 $.

Input

The input will contain one integer N (0 < N < 30).

Output

Print the sum of the Nth row of Pascal’s triangle.

Sample

InputOutput
5
16


    Discussion
    Statistics

    96% Solution Ratio

    nurbijoyEarliest, 11M ago

    nurbijoyFastest, 0.0s

    ReduancsLightest, 0 B

    saitotaShortest, 16B

    Submit

    Login to submit