-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSWEA3809.java
56 lines (45 loc) · 1.05 KB
/
SWEA3809.java
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
package com.ssafy.algo;
import java.util.Scanner;
public class SWEA3809 {
static boolean flag;
static int[] visit;
static int test;
public static void check(int k,int tc) {
for (int i = 0; i < k; i++) {
if(visit[i] == 0) {
System.out.println("#"+(tc+1)+" "+i);
flag = false;
break;
}
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
test = sc.nextInt();
for (int tc = 0; tc < test; tc++) {
flag = true;
visit = new int[100001];
String str = "";
int k = sc.nextInt();
for (int i = 0; i < k; i++) {
int n =sc.nextInt();
str += Integer.toString(n);
}
int idx = 1;
int range = 10;
int length = str.length();
while(flag) {
for (int i = 0; i < length; i++) {
visit[Integer.parseInt(str.substring(i,i+idx))] = 1;
//System.out.println(str.substring(i,i+idx));
}
check(range,tc);
range*=10;
idx++;
length--;
}
//System.out.println(idx);
}
}
}