Skip to content

Commit abae374

Browse files
authored
Create 11053.md
1 parent f16984d commit abae374

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

BOJ/dp/11053.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
```
2+
package algo;
3+
4+
import java.io.BufferedReader;
5+
import java.io.IOException;
6+
import java.io.InputStreamReader;
7+
import java.util.*;
8+
9+
public class Main {
10+
public static void main(String[] args) throws IOException {
11+
Scanner in = new Scanner(System.in);
12+
int n = in.nextInt();
13+
int[] numbers = new int[1001];
14+
int[] dp = new int[1001];
15+
for (int i = 0; i < n; i++) {
16+
numbers[i] = in.nextInt();
17+
}
18+
19+
dp[0] = 1;
20+
int max = 1;
21+
for (int i = 1; i < n; i++) {
22+
dp[i] = 1;
23+
for (int j = 0; j < i; j++) {
24+
if (numbers[i] > numbers[j] && dp[i] <= dp[j]) {
25+
dp[i] = dp[j] + 1;
26+
}
27+
}
28+
max = Math.max(max, dp[i]);
29+
}
30+
System.out.println(max);
31+
}
32+
}
33+
34+
35+
36+
37+
38+
39+
40+
```

0 commit comments

Comments
 (0)