1058 求级数的第N项


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 32M

Problem types
Allowed languages
C, C++, Java, Python

Description

已知级数的通项公式为: f(1) = 0; f(2) = 2; f(n) = 3f(n-1)+5f(n-2)(n>2)。 对于输入的一些正整数(其值≤16,其个数≤10000),分别求其通项值。当文件读到0时,运行结束。

Sample

Input

3 5 9 0

Output

6
114
35454

Comments

There are no comments at the moment.