-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSWEA_1288.java
More file actions
41 lines (31 loc) · 930 Bytes
/
SWEA_1288.java
File metadata and controls
41 lines (31 loc) · 930 Bytes
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
package ps;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class SWEA_1288 {
public static void main(String[] args) throws Exception{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int N = Integer.parseInt(in.readLine());
for(int i=1;i<=N;i++) {
int num = Integer.parseInt(in.readLine());
int answerMasking = (1<<10)-1;
int visited = 0;
int count = 1;
while(true) {
int val = num*count;
String sVal = Integer.toString(val);
for(int j=0;j<sVal.length();j++) {
int c = sVal.charAt(j) - '0';
visited = visited | (1 << c);
}
//if( (visited ^ answerMasking) == 0){
if( visited == answerMasking) {
sb.append("#"+i+" "+num*count+"\n");
break;
}
count++;
}
}
System.out.println(sb);
}
}