From 1f99cbe288cf9cabf5ca955cbfc08d5d80366f6f Mon Sep 17 00:00:00 2001 From: yenru0 Date: Thu, 7 May 2020 20:13:23 +0900 Subject: [PATCH] =?UTF-8?q?=EC=83=88=EB=A1=9C=EC=9A=B4=20=EC=86=8C?= =?UTF-8?q?=EC=88=98=EC=9D=98=20=EC=A7=80=ED=8F=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zeta_python/15965_sieve.py | 4 ++++ zeta_python/completed/15965.py | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 zeta_python/15965_sieve.py create mode 100644 zeta_python/completed/15965.py diff --git a/zeta_python/15965_sieve.py b/zeta_python/15965_sieve.py new file mode 100644 index 0000000..9e2aa87 --- /dev/null +++ b/zeta_python/15965_sieve.py @@ -0,0 +1,4 @@ +# 먼저 최대 개수까지 빈 리스트 만듬; +# 그 다음 반복문 돔 +# 그리고 배수만큼을 없앰 +# 그리고 반복 \ No newline at end of file diff --git a/zeta_python/completed/15965.py b/zeta_python/completed/15965.py new file mode 100644 index 0000000..7ec64f0 --- /dev/null +++ b/zeta_python/completed/15965.py @@ -0,0 +1,18 @@ +c = 2; n =int(input()); P = [] +if n == 1: + print(2) +else: + k = 3 + while c <= n: + for p in P: + if k%p == 0: + break + if p**2 > k: + P.append(k) + c+=1 + break + else: + P.append(k) + c+=1 + k += 2 + print(P[-1])