forked from wotjd4305/Algorithm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswe3307.java
More file actions
59 lines (39 loc) · 1 KB
/
swe3307.java
File metadata and controls
59 lines (39 loc) · 1 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import java.util.Scanner;
public class swe3307 {
static int answer = 0;
static int[] Arr;
static int[] opt;
static Scanner sc = new Scanner(System.in);
static int Ncount;
public static void main(String[] args) {
int T = sc.nextInt();
//테스트케이스
for(int t=0; t<T; t++) {
answer = 0;
Ncount = sc.nextInt();
Arr = new int[Ncount];
opt = new int[1001];
LIS(Ncount);
System.out.println("#" + (t+1) + " " + answer);
}
}
public static void LIS(int N)
{
for(int i=0; i<N; i++ )
{
Arr[i] = sc.nextInt();
}
for(int i=0; i<N; i++)
{
opt[i] = 1;
for(int j=0; j<i; j++)
{
if(Arr[j] < Arr[i] && opt[i] < opt[j] +1)
{
opt[i] = opt[j] +1;
}
answer = Math.max(opt[i], answer);
}
}
}
}