본문 바로가기

ALGORITHM/SWEA

[SWEA D1] 1933. 간단한 N의 약수(Python)

문제 링크

https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=1&contestProbId=AV5PhcWaAKIDFAUq&categoryId=AV5PhcWaAKIDFAUq&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=ALL&select-1=1&pageSize=10&pageIndex=2 

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com


제출 코드

- Pass

input_data = int(input())
result = ''
for i in range(1, input_data + 1):
# 나눴을 때 나머지가 0이 되는 수를 출력
    if input_data % i == 0:
        result = result + str(i) + ' '
print(result[:-1])

 


풀이

  • 1에서부터 입력된 숫자까지의 수 중 입력된 수를 나눈 나머지가 0이 되는 수를 출력.

알아둘 것