File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
src/main/java/sgyj/backjun/seunggu Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ package sgyj .backjun .seunggu ;
2
+
3
+ import java .io .BufferedReader ;
4
+ import java .io .IOException ;
5
+ import java .io .InputStreamReader ;
6
+ import java .util .Arrays ;
7
+
8
+ class Main25501 {
9
+
10
+
11
+ public static void main (String [] args ){
12
+ try ( BufferedReader reader = new BufferedReader ( new InputStreamReader (System .in ) ) ) {
13
+ int count = Integer .parseInt (reader .readLine ());
14
+ int [] arr = Arrays .stream ( reader .readLine ().split (" " ) ).mapToInt (Integer ::parseInt ).toArray ();
15
+ int [] dy =new int [count ];
16
+ dy [0 ] = 1 ;
17
+ int answer = 0 ;
18
+ for (int i =1 ; i < arr .length ; i ++) {
19
+ int max = 0 ;
20
+ for (int j =i -1 ; j >= 0 ; j --) {
21
+ if (arr [j ] < arr [i ] && dy [j ] > max ) max = dy [j ];
22
+ }
23
+ dy [i ] = max + 1 ;
24
+ answer = Math .max (answer , dy [i ]);
25
+ }
26
+ System .out .println (answer );
27
+
28
+ } catch ( IOException e ) {
29
+ e .printStackTrace ();
30
+ }
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments