// 繼續大數,哎、、
problem description
a fibonacci sequence is calculated by adding the previous two members the sequence, with the first two members being both 1.
f(1) = 1, f(2) = 1, f(3) = 1,f(4) = 1, f(n>4) = f(n - 1) + f(n-2) + f(n-3) + f(n-4)
your task is to take a number as input, and print that fibonacci number.
input
each line will contain an integers. process to end of file.
output
for each case, output the result in a line.
sample input
sample output
author
戴帽子的
/**************************************
模拟斐波那契數列 , 不過遞推公式變成了 f1 = f2 = f3 = f4 = 1 , f(n) = f(n-1) + f(n-2) + f(n-3) +f(n-4) . (n>=5) , 最大的數有2005位,是以,用大數吧
用的 跟 hdu1042 n! 的方法一樣,用 十萬 進制解決,每個整形存 10000,當然更大點也可以。。
**************************************/
code: