Guest User

Untitled

a guest
Mar 17th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Main {
  3. public static void main(String[] args) {
  4. Scanner scan = new Scanner(System.in);
  5. int n=scan.nextInt();;
  6. int []d=new int[1001];
  7. d[0]=1;
  8. d[1]=1;
  9. for(int i=2;i<=n;i++) {
  10. d[i]=d[i-1]+2*d[i-2];
  11. d[i]%=10007;
  12. }
  13. System.out.println(d[n]);
  14. scan.close();
  15. }
  16. }
Add Comment
Please, Sign In to add comment