Towers of Hanoi
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Three pegs are given. The first peg contains n disks in ascending order of their size from top to bottom. The other two pegs are empty. You must move all disks from the first peg to the second. You can move each time only one disk. It is not allowed to put a larger disk on a smaller one.
How many legal configurations of n disks on three pegs are there?
Input
One integer n (1 ≤ n ≤ 20).
Output
Print the number of legal configurations.
Examples
Input #1
Answer #1
Submissions 277
Acceptance rate 37%