백준5086: 배수와 약수
문제
https://www.acmicpc.net/problem/5086
문제 풀이
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
int n = sc.nextInt();
int m = sc.nextInt();
if (n == 0 && m == 0) {
break;
}
if (m % n == 0) {
System.out.println("factor");
} else if (n % m == 0) {
System.out.println("multiple");
} else {
System.out.println("neither");
}
}
}
}
댓글남기기