SWEA_1288) 새로운 불면증 치료법
SWEA
# D2
1288) 새로운 불면증 치료법 (19.10.03)
문제 링크 (SW Expert Academy)
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
|
import java.io.*;
public class Solution {
public static void main(String args[]) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int t = Integer.parseInt(br.readLine());
for(int i=1;i<=t;i++) {
boolean ch[] = new boolean[10];
String n = br.readLine();
int N = Integer.parseInt(n);
int r = 1;
int nn = 1;
int ans = 1;
while(true) {
nn = N*r;
ans = nn;
while(nn>0) {
int k = nn%10;
ch[k] = true;
nn = nn/10;
}
int cnt = 0;
for(boolean p : ch) {
if(p==false) {
r = r+1;
break;
}else cnt = cnt+1;
}
if(cnt==10) {
bw.write("#" + i + " " + ans+"\n");
break;
}
}
}
bw.flush();
bw.close();
}
}
| cs |
댓글
댓글 쓰기