반응형
m = int(input())
n = int(input())
result=[]
def f(n):
found = True
if n < 2:
return -1
elif n == 2:
return n
else:
for i in range(2,int(n/2)+1):
if n%i==0:
found = False
if found:
return n
else:
return -1
for i in range(m,n+1):
if f(i)!= -1:
result.append(i)
if not result:
print(-1)
else:
print(sum(result))
print(min(result))
반응형
'Algorithm > Baekjoon' 카테고리의 다른 글
2798 (0) | 2021.05.09 |
---|---|
11729 (0) | 2021.05.09 |
1978 (0) | 2021.05.08 |
2839 (0) | 2021.05.08 |
2775 (0) | 2021.05.06 |