#C3154. Counting Branches in Alice's Tree
Counting Branches in Alice's Tree
Counting Branches in Alice's Tree
Alice planted a magical tree that grows in a unique way. Initially, there is only 1 branch. The tree grows each year based on the following rules:
- If the year is odd, every branch multiplies by 4.
- If the year is even, every branch multiplies by 2.
You are required to compute the total number of branches after N years. The growth can be formally expressed as:
$$ B = 1 \times \prod_{i=1}^{N} \begin{cases} 4, & \text{if } i \text{ is odd} \\ 2, & \text{if } i \text{ is even} \end{cases} $$
Note that input is given via stdin and output should be printed to stdout.
inputFormat
The input consists of a single integer N
(where 1 ≤ N ≤ 10^5
), which represents the number of years since the tree was planted.
outputFormat
Output a single integer, the total number of branches on the tree after N
years.
1
4
</p>