Fibonacci Sequence
Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 393 Accepted Submission(s) : 173
Font: Times New Roman | Verdana | Georgia
Font Size: ← →
Problem Description
Do you know the famous "Fibonacci Sequence"? In this sequence, f(0)=0, f(1)=1, when the
integer n greater than 1, we define that f(n) = f(n-1) + f(n-2). I will give you a integer n, you
should output the f(n). And you should know that the f(n) could be too large, so the result should
mod 10000007.
integer n greater than 1, we define that f(n) = f(n-1) + f(n-2). I will give you a integer n, you
should output the f(n). And you should know that the f(n) could be too large, so the result should
mod 10000007.
Input
Input contains multiple test cases. Each test case contains an integer N (0<=N<=1000). Input
will be ended by the end of file.
will be ended by the end of file.
Output
In each case, you should output the f(N) in one line.
Sample Input
3 5 6
Sample Output
2 5 8
Author
Source
2012年华南师范大学校赛初赛