Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class fibonacci_dp {
- static int[] dp=new int[100000];
- public static void main (String[] args){
- dp[0]=1; dp[1]=1;
- for (int i=2;i<100000;i++){
- dp[i]=dp[i-1]+dp[i-2];
- }
- Scanner input=new Scanner (System.in);
- int num=input.nextInt();
- System.out.format("%d\n",dp[num]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement