- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11727.java
More file actions
Latest commit
27 lines (19 loc) · 509 Bytes
/
Copy path11727.java
File metadata and controls
27 lines (19 loc) · 509 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
importjava.util.*;
publicclassMain {
publicstaticvoidmain(String[] args) {
Scannersc = newScanner(System.in);
intn = sc.nextInt();
if(n==1) {
System.out.println(1);
return;
}
int[] arr = newint[n+1];
arr[1] = 1;
arr[2] = 3;
for(inti=3; i<n+1; i++) {
arr[i] = (arr[i-1] % 10007) + (arr[i-2] % 10007) * 2;
arr[i] %= 10007;
}
System.out.println(arr[n]);
}
}