C0n + ... + Cnn#9892

C0n + ... + Cnn (Editorial)

The formula of the binomial theorem is as follows:

(a + b)^n = \sum_{i = 0}^n{C_n^ia^ib^{n-i}}

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

(1 + 1)^n = \sum_{i = 0}^n{C_n^i1^i1^{n-i}}

or

2^n = \sum_{i = 0}^n{C_n^i} = C_n^0 + C_n^1 + ... + C_n^n

Thus, the indicated sum equals 2^n.

Example

If n = 1, then C_1^0 + C_1^1 = 1 + 1 = 2

If n = 2, then C_2^0 + C_2^1 + C_2^2 = 1 + 2 + 1 = 4

If n = 3, then C_3^0 + C_3^1 + C_3^2 + C_3^3 = 1 + 3 + 3 + 1 = 8

Algorithm realization

Read the input value of .

scanf("%lld", &n);

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

res = 1LL << n;
printf("%lld\n", res);

Python realization

Read the input value of .

n = int(input())

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

res = 1 << n
print(res)