Coding Problem/백준

[백준] 5086 - 배수와 약수

마탁이 2021. 5. 31. 20:00

https://www.acmicpc.net/problem/5086

 

5086번: 배수와 약수

각 테스트 케이스마다 첫 번째 숫자가 두 번째 숫자의 약수라면 factor를, 배수라면 multiple을, 둘 다 아니라면 neither를 출력한다.

www.acmicpc.net

  • 간단한 판별 문제이다.
더보기
import sys
input = sys.stdin.readline

'''
    첫 번째 숫자가 두 번째 숫자의 약수라면 factor
    배수라면 multiple
    둘 다 아니라면 neither
'''
answerList = [ 'factor', 'multiple', 'neither']

while(True):
    testCase = list(map(int, str(input()).split()))
    if 0 == testCase[0] and 0 == testCase[1]: break

    if 0 == testCase[1] % testCase[0]: print(answerList[0])
    elif 0 == testCase[0] % testCase[1]: print(answerList[1])
    else: print(answerList[2])

'Coding Problem > 백준' 카테고리의 다른 글

[백준] 2004 - 조합 0의 개수  (0) 2021.06.01
[백준] 9375 - 패션왕 신해빈  (0) 2021.05.31
[백준] 3036 - 링  (0) 2021.05.31
[백준] 1676 - 팩토리얼 0의 개수  (0) 2021.05.31
[백준] 1037 - 약수  (0) 2021.05.31