백준 2581 파이썬 (1) 썸네일형 리스트형 [백준] 2581 소수 Python (주어진 범위 내 소수들의 합, 최소값) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 m = int(input()) n = int(input()) lists = [] for i in range(m, n+1): check = 0 if i >= 2: if i == 2: lists.append(i) else: for j in range(2, i): if i%j == 0: check = 1 break if check == 0: lists.append(i) if len(lists) >= 1: print(sum(lists)) print(min(lists)) else: print(-1) 이전 1 다음