풀이_01

언어/python2018. 9. 5. 23:48
"""
http://59.23.150.58/30stair/complete/complete.php?pname=complete
"""
import math

while True:
number = int(input("정수 입력: "))
if 1 <= number <= 1000:
break
else:
print ("반드시 1000 이하의 자연수를 입력해주세요")

numList = []
for i in range(1, int(math.sqrt(number) + 1)):
if number%i == 0:
numList.extend([i, number//i])

# 오름차순으로 정렬
numList.sort()
numList = numList[:len(numList)-1]
if sum(numList) == number:
print ("yes")
else:
print ("no")


'언어 > python' 카테고리의 다른 글

풀이_03  (0) 2018.09.05
풀이2  (0) 2018.09.05
sql_injection test code  (2) 2018.08.14
s1  (0) 2018.08.02
멀티 쓰레드  (0) 2018.07.12