All tasks
Mediumrecursiondpmath

Fibonacci Number

Time limit 2 s · Memory 64 MBAcceptance: 33.3%Solved by: 1

Statement

You are given an integer n. Print F(n), where F(0) = 0, F(1) = 1, F(k) = F(k-1) + F(k-2).

Examples

Example 1
Input
10
Output
55
Example 2
Input
0
Output
0

Constraints

  • 0 ≤ n ≤ 90
Solve this task to unlock the editorial.

AI tutor

Stuck? Get a nudge — the tutor explains the idea, it never hands you the solution.