Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. import java.io.File;
  2. import java.io.FileNotFoundException;
  3. import java.io.PrintWriter;
  4. import java.math.BigInteger;
  5. import java.util.Scanner;
  6.  
  7. public class dpF {
  8. public static void main(String[] args) throws FileNotFoundException {
  9. Scanner in = new Scanner(new File("input.txt"));
  10. PrintWriter out = new PrintWriter(new File("output.txt"));
  11. int N = in.nextInt();
  12. BigInteger[] kol = new BigInteger[N+2];
  13. kol[0] = BigInteger.ONE;
  14. kol[1] = BigInteger.ONE;
  15. for (int i = 2; i <=N+1 ; i++) {
  16. kol[i] = new BigInteger("0");
  17.  
  18. kol[i] = kol[i].add(kol[i-1]);
  19. kol[i] = kol[i].add(kol[i-2]);
  20.  
  21. }
  22. out.println(kol[N+1]);
  23. out.close();
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement