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