We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents a65afa4 + 6d24006 commit e03ae09Copy full SHA for e03ae09
1 file changed
hh830/BOJ_11722.java
@@ -0,0 +1,31 @@
1
+import java.io.*;
2
+import java.util.*;
3
+
4
+public class BOJ_11722 {
5
+ public static void main(String[] args) throws IOException {
6
+ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
7
8
+ int N = Integer.parseInt(bufferedReader.readLine());
9
+ int A[] = new int[N];
10
+ int dp[] = new int[N];
11
12
+ StringTokenizer stringTokenizer = new StringTokenizer(bufferedReader.readLine());
13
+ for (int i = 0; i < N; i++) {
14
+ A[i] = Integer.parseInt(stringTokenizer.nextToken());
15
+ }
16
17
+ int max = 0;
18
19
+ for(int i=0;i<N;i++) {
20
+ dp[i] = 1;
21
+ for (int j = 0; j < i; j++) {
22
+ if (A[j] > A[i]) {
23
+ dp[i] = Math.max(dp[i], dp[j] + 1);
24
25
26
+ max = Math.max(max, dp[i]);
27
28
29
+ System.out.println(max);
30
31
+}
0 commit comments