#K40787. Efficient Fibonacci Calculation using Dynamic Programming
Efficient Fibonacci Calculation using Dynamic Programming
Efficient Fibonacci Calculation using Dynamic Programming
This problem requires you to compute the n-th Fibonacci number using a dynamic programming approach. The Fibonacci sequence is defined as:
\(F(0)=0, F(1)=1\) and \(F(n)=F(n-1)+F(n-2)\) for \(n \ge 2\).
Your task is to read an integer n
from standard input and output the n-th Fibonacci number to standard output.
Ensure that your solution is efficient enough to handle reasonably large values of n
.
inputFormat
The input consists of a single integer n
(where 0 \le n <= 90
to avoid overflow issues). The input is provided via standard input.
outputFormat
Output a single integer, the n-th Fibonacci number, to standard output.
## sample0
0