Time

18:07:47
22 May 2012
Version for print

Two digits

   How many n-digit numbers can be created using only digits 5 and 9, where no three identical digits stand side by side?


Specifications

   Input

   One number n (n30).

   Output

   The amount of n-digit numbers.


Problem information

Time Limit: 1.3 seconds
Memory Limit: 64 MB
Balls for the passed test: 10
Complexity: 19% 361/448
Classes: Dynamic programming

Example

Example input

3

Example output

6


← Prison escape Problems Long number (RU) →