Banner Home Page DIY Contests Problems Ranklist Status Statistics
pdf版的题目下载:初赛goo.gl/rfbDY,决赛goo.gl/fNcyY。K题请使用GUN C++提交,用VC/VC++提交会返回RE。

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.

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.

Output

In each case, you should output the f(N) in one line.

Sample Input

3
5
6

Sample Output

2
5
8

Author

Jeflie

Source

2012年华南师范大学校赛初赛

Statistic | Submit | Back