fabonaci numbers


Submit solution

Points: 20 (partial)
Time limit: 5.0s
Memory limit: 256M

Authors:
Problem types

題目說明

請輸入一整數N,並輸出費波納契數列的第N位

費氏數列:1, 1, 2, 3, 5, 8, 13, 21, 34...

※此處費氏數列規則: 第一二位固定為1,第三位開始為前兩位相加,如第三位 = 第一位 + 第二位, 第五位 = 第三位 + 第四位

輸入限制: 均>=0

輸入

整數N

輸出

費波那契數列第N位的值

sample input1

3

sample output1

2

sample input2

5

sample output2

5

Comments

There are no comments at the moment.