Skip to content

Commit 3235371

Browse files
authored
Create 2960_에라토스테네스의 체(S4).py
1 parent 1527483 commit 3235371

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
N, K = map(int, input().split())
2+
# N : 마지막 수
3+
# K : k번째 지우는 수
4+
5+
l=[]
6+
c=[0]*(N-1)
7+
s=[]
8+
9+
# 2~N까지의 범위 리스트 생성
10+
for i in range(2, N+1):
11+
l.append(i)
12+
13+
for i in range(2,N+1):
14+
for j in l:
15+
if(j%i==0):
16+
if(j in s): continue
17+
else: s.append(j)
18+
print(s[K-1])

0 commit comments

Comments
 (0)