From 4bcb1e9c23d6bef6551f04aaceb570cbe4b330b0 Mon Sep 17 00:00:00 2001 From: yenru0 Date: Sat, 26 Sep 2020 13:30:10 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A1=B0=ED=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zeta_python/2981.py | 9 +++++++++ zeta_python/completed/11050.py | 13 +++++++++++++ zeta_python/completed/11051.py | 17 +++++++++++++++++ zeta_python/completed/2609.py | 8 ++++++++ 4 files changed, 47 insertions(+) create mode 100644 zeta_python/2981.py create mode 100644 zeta_python/completed/11050.py create mode 100644 zeta_python/completed/11051.py create mode 100644 zeta_python/completed/2609.py diff --git a/zeta_python/2981.py b/zeta_python/2981.py new file mode 100644 index 0000000..676a0e8 --- /dev/null +++ b/zeta_python/2981.py @@ -0,0 +1,9 @@ +N = int(input()) +I = sorted([int(input())for i in range(N)]) +p = min([(j-i) for i, j in zip(I, I[1:])]) +print(p) +T = [t for t in range(1, int(p**(1/2))+1) if p % t == 0] +if T[-1] == p // T[-1]: + print(" ".join([str(t) for t in T[1:-1]] + [str(p // t) for t in T[::-1]])) +else: + print(" ".join([str(t) for t in T[1:]] + [str(p // t) for t in T[::-1]])) diff --git a/zeta_python/completed/11050.py b/zeta_python/completed/11050.py new file mode 100644 index 0000000..816e718 --- /dev/null +++ b/zeta_python/completed/11050.py @@ -0,0 +1,13 @@ +N, K = map(int, input().split()) + + +def C(n, k): + if n == 1: + return 1 + elif k == 0 or k == n: + return 1 + else: + return C(n - 1, k) + C(n - 1, k - 1) + + +print(C(N, K)) diff --git a/zeta_python/completed/11051.py b/zeta_python/completed/11051.py new file mode 100644 index 0000000..eedbd0a --- /dev/null +++ b/zeta_python/completed/11051.py @@ -0,0 +1,17 @@ +import sys +sys.setrecursionlimit(12000) +N, K = map(int, input().split()) +Mem = [[0]*1001for i in range(1001)] + +def C(n, k): + if n == 1: + return 1 + elif k == 0 or k == n: + return 1 + if Mem[n][k] != 0: + return Mem[n][k] + t = (C(n - 1, k) + C(n - 1, k - 1)) % 10007 + Mem[n][k] = t + return t + +print(C(N, K)) diff --git a/zeta_python/completed/2609.py b/zeta_python/completed/2609.py new file mode 100644 index 0000000..54764cf --- /dev/null +++ b/zeta_python/completed/2609.py @@ -0,0 +1,8 @@ +A, B = map(int, input().split()) +p = 1 +for i in range(A, 1, -1): + if A % i == 0 and B % i == 0: + p = i + break +print(p) +print(A*B//p) \ No newline at end of file