-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathA_Large.java
More file actions
38 lines (32 loc) · 829 Bytes
/
A_Large.java
File metadata and controls
38 lines (32 loc) · 829 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
/*
* Author: Minho Kim (ISKU)
* Date: 2017.04.07
* E-mail: minho1a@hanmail.net
*
* https://github.com/ISKU/Algorithm
* https://code.google.com/codejam/contest/6254486/dashboard#s=p0
*/
import java.util.Scanner;
public class A_Large {
public static void main(String... args) {
Scanner input = new Scanner(System.in);
int testCase = input.nextInt();
for (int t = 1; t <= testCase; t++) {
long N = input.nextLong();
int check = 0;
if (N == 0)
System.out.printf("Case #%d: INSOMNIA\n", t);
else {
for (long i = 1; ; i++) {
String[] number = String.valueOf(N * i).split("");
for (int j = 0; j < number.length; j++)
check |= 1 << Integer.parseInt(number[j]);
if (check == 1023) {
System.out.printf("Case #%d: %d\n", t, N * i);
break;
}
}
}
}
}
}