From 38e8440284c45974556d60f0372ae8023d3d67bf Mon Sep 17 00:00:00 2001 From: yenru0 Date: Fri, 7 Aug 2020 23:04:40 +0900 Subject: [PATCH] =?UTF-8?q?1456=EC=9D=80=20=EA=B5=89=EC=9E=A5=ED=9E=88=20?= =?UTF-8?q?=EC=96=B4=EB=A0=B5=EC=8A=B5=EB=8B=88=EB=8B=A4.=20=EC=96=B4?= =?UTF-8?q?=EB=96=BB=EA=B2=8C=20=EC=A0=80=EA=B1=B8=20Python=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=ED=95=B4=EB=A8=B9=EC=A3=A0=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zeta_python/completed/1427.py | 1 + zeta_python/completed/1456.py | 28 ++++++++++++++++++++++++++++ zeta_python/completed/2108.py | 30 ++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 zeta_python/completed/1427.py create mode 100644 zeta_python/completed/1456.py create mode 100644 zeta_python/completed/2108.py diff --git a/zeta_python/completed/1427.py b/zeta_python/completed/1427.py new file mode 100644 index 0000000..6b1b762 --- /dev/null +++ b/zeta_python/completed/1427.py @@ -0,0 +1 @@ +for i in sorted(map(int, input()))[::-1]:print(i, end='') \ No newline at end of file diff --git a/zeta_python/completed/1456.py b/zeta_python/completed/1456.py new file mode 100644 index 0000000..e72f794 --- /dev/null +++ b/zeta_python/completed/1456.py @@ -0,0 +1,28 @@ +A, B = map(int, input().split()) +P = [2] +cnt = 0 +t = 4 +while B >= t: + if A <= t <= B: + cnt += 1 + t *= 2 +for i in range(3, int(B ** (1 / 2)) + 1, 2): + for p in P: + if i % p == 0: + break + elif i < p ** 2: + P.append(i) + t = i * i + while B >= t: + if A <= t <= B: + cnt += 1 + t *= i + break + else: + P.append(i) + t = i * i + while B >= t: + if A <= t <= B: + cnt += 1 + t *= i +print(cnt) # 매우 빨라지고 싶은 에라토스테네스 내장형++ diff --git a/zeta_python/completed/2108.py b/zeta_python/completed/2108.py new file mode 100644 index 0000000..5156480 --- /dev/null +++ b/zeta_python/completed/2108.py @@ -0,0 +1,30 @@ +import sys +N = int(sys.stdin.readline()) +C = [0] * 8001 +I = [] +for i in range(N): + t = int(sys.stdin.readline()) + C[t + 4000] += 1 + I.append(t) +print(round(sum(I)/N)) +I.sort() +print(I[N//2]) +M, m = I[-1], I[0] + +mor = 0 +ner = 0 +cnd = 0 +for i, c in enumerate(C): + if c > mor: + mor = c + cnd = 0 + ner = i + elif c == mor: + if cnd == 0: + cnd = 1 + ner = i + elif cnd == 1: + pass +print(ner - 4000) + +print(abs(M-m))