3507: Pell数列

Memory Limit:256 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

[md] Pell数列$a\_1,a\_2,a\_3, ...$的定义是这样的,$a\_1 = 1, a\_2 = 2, ... , a\_n = 2 a\_{n−1} + a\_{n-2}(n>2)$。 给出一个正整数 $k$,要求Pell数列的第 $k$ 项模上 $32767$ 是多少。 [/md]

Sample Input Copy

2
1
8

Sample Output Copy

1
408