Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. import java.util.*;
  2. public class fibonacci_dp {
  3. static int[] dp=new int[100000];
  4. public static void main (String[] args){
  5. dp[0]=1; dp[1]=1;
  6. for (int i=2;i<100000;i++){
  7. dp[i]=dp[i-1]+dp[i-2];
  8. }
  9. Scanner input=new Scanner (System.in);
  10. int num=input.nextInt();
  11. System.out.format("%d\n",dp[num]);
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement