-
Notifications
You must be signed in to change notification settings - Fork 2
/
116.txt
42 lines (29 loc) · 845 Bytes
/
116.txt
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
import java.util.Scanner;
public class Main {
/**
* @param args the command line arguments
*/
public static int rema(String str, int divider) {
int eded = 0;
int len = str.length();
for (int i = 0; i < len; i++) {
eded = (eded * 10) + (str.charAt(i) - 48);
eded %= divider;
}
return eded;
}
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int num = input.nextInt();
int divider = input.nextInt();
String str = String.valueOf(num);
while (true) {
if (rema(str, divider) == 0) {
System.out.println(num);
break;
}
num++;
str = str.concat(String.valueOf(num));
}
}
}