9892. C0n + … + Cnn

 

Given a non-negative integer n, find the sum of binomial coefficients:

 

Input. One non-negative integer n (n ≤ 60).

 

Output. Print the value of the sum.

 

Sample input

Sample output

2

4

 

 

SOLUTION

combinatorics

 

Algorithm analysis

The formula of the binomial theorem is as follows:

If we set a = b = 1, then this relation takes the following form:

 

or

Thus, the indicated sum equals 2n.

 

Example

If n = 1, then  = 1 + 1 = 2;

If n = 2, then  = 1 + 2 + 1 = 4;

If n = 3, then  = 1 + 3 + 3 + 1 = 8;

 

Algorithm realization

Read the input value of n.

 

scanf("%lld", &n);

 

Compute and print the result, the value of 2n.

 

res = 1LL << n;

printf("%lld\n", res);

 

Python realization

Read the input value of n.

 

n = int(input())

 

Compute and print the result, the value of 2n.

 

res = 1 << n

print(res)