1970: Fibonacci sequence
内存限制:128 MB
时间限制:1.000 S
评测方式:文本比较
命题人:
提交:26
解决:17
题目描述
The Fibonacci sequence refers to such a sequence of 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765 , 10946, 17711, 28657, 46368........
Through observation, we can know the law of this sequence: this sequence starts from the third item, and each item is equal to the sum of the first two items.
Now please program to find any item of this sequence.
输入
There are multiple groups of input. Each group of a positive integer n indicates that the nth item of the sequence is required.
输出
Output the value of the nth item of this sequence.
样例输入 复制
1
2
3
4
5
6
7
8
9
10
样例输出 复制
1
1
2
3
5
8
13
21
34
55