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