https://www.acmicpc.net/problem/5086
5086번: 배수와 약수
각 테스트 케이스마다 첫 번째 숫자가 두 번째 숫자의 약수라면 factor를, 배수라면 multiple을, 둘 다 아니라면 neither를 출력한다.
www.acmicpc.net
풀이
while True:
a,b = map(int,input().split())
if a==0 and b==0: break
if a%b==0: print("multiple")
elif b%a==0: print("factor")
else: print("neither")
조건문을 사용하면된다.
'코딩테스트 > Python' 카테고리의 다른 글
[Python] 백준 #10773- 제로 (0) | 2021.12.01 |
---|---|
[Python] 백준 #10828 - 스택 (0) | 2021.12.01 |
[Python] 백준 #15652 - N과 M (4) (0) | 2021.12.01 |
[Python] 백준 #15651 - N과 M (3) (0) | 2021.12.01 |
[Python] 백준 #15650 - N과 M (2) (0) | 2021.12.01 |