AMZSEQ  AMZ Word
AmzMohammad is a novice problem setter in Spoj. for start of his work he decided to write a classical and sample problem. (for UI ACM summer program )
how many Nwords (words with N letters) from the alphabet {0,1,2} are such that neighbors differ at most by 1?
Input
a positive integer N.
Output
Number of Nwords with told conditions.
answer is less than 1000000000. it is the only constraint :)
Example
Input: 2 Output: 7
hide comments
ameyanator:
20180325 15:04:05
simple dp. Possible corner case N=1 

vipul_17:
20180211 15:43:26
Any corner test case anyone?


nadstratosfer:
20171124 06:32:47
utkarshsingh99: Calculate how many ndigit numbers in base 3 are there such that the difference between any pair of adjacent digits is 0 or 1. 

utkarshsingh99:
20171122 22:54:44
Can anyone explain what exactly is the problem statement trying to say? 

vengatesh15:
20170327 09:42:28
easy dp... 

vignesh294:
20161220 13:52:59
@surajmall: The seven Nwords for N=2 are: 00, 01, 11, 10, 12, 22, 21.


surajmall:
20161211 16:58:58
anyone can make me understand the given test case how output 7 come


sri:
20160925 17:30:04
100th


hackerman97:
20160328 19:30:47
Could be better if N was large 

minhthai:
20160121 05:51:55
don't think too much about math... 
Added by:  mohammad mahmoodi 
Date:  20120731 
Time limit:  0.100s0.197s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 
Resource:  AmzMohammad ( Mohammad Mahmoodi ) 