새로운 불면증 치료법
in Algorithm on SW Expert Academy
Software Expert Academy [1288] 새로운 불면증 치료법
소스코드
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int tc = 1; tc <= T; tc++) {
boolean[] num = new boolean[10];
int chk = 0;
int cnt = 1;
int N = sc.nextInt();
int sheep = N;
out: while (true) {
String str = sheep + "";
for (int i = 0; i < str.length(); i++) {
int n = str.charAt(i) - '0';
if (!num[n]) {
chk++;
num[n] = true;
}
if (chk == 10)
break out;
}
sheep = ++cnt * N;
}
System.out.println("#" + tc + " " + sheep);
}
}
}