From 75bb54035cc9de7349346ffe313b1eaeb564302d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=20=EC=9D=80=EC=A0=95?= Date: Sun, 16 Oct 2022 13:31:40 +0900 Subject: [PATCH 1/3] =?UTF-8?q?221016=EC=88=99=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2.\354\210\230\355\225\231/10818.py" | 4 ++++ .../2.\354\210\230\355\225\231/10870.py" | 8 +++++++ .../1292(\355\213\200\353\246\274).py" | 11 ++++++++++ "HomeWork/2.\354\210\230\355\225\231/1978.py" | 18 +++++++++++++++ "HomeWork/2.\354\210\230\355\225\231/2309.py" | 21 ++++++++++++++++++ "HomeWork/2.\354\210\230\355\225\231/2460.py" | 9 ++++++++ "HomeWork/2.\354\210\230\355\225\231/2501.py" | 12 ++++++++++ "HomeWork/2.\354\210\230\355\225\231/2581.py" | 22 +++++++++++++++++++ "HomeWork/2.\354\210\230\355\225\231/2609.py" | 17 ++++++++++++++ "HomeWork/2.\354\210\230\355\225\231/2693.py" | 7 ++++++ .../3460(\355\213\200\353\246\274).py" | 11 ++++++++++ 11 files changed, 140 insertions(+) create mode 100644 "HomeWork/2.\354\210\230\355\225\231/10818.py" create mode 100644 "HomeWork/2.\354\210\230\355\225\231/10870.py" create mode 100644 "HomeWork/2.\354\210\230\355\225\231/1292(\355\213\200\353\246\274).py" create mode 100644 "HomeWork/2.\354\210\230\355\225\231/1978.py" create mode 100644 "HomeWork/2.\354\210\230\355\225\231/2309.py" create mode 100644 "HomeWork/2.\354\210\230\355\225\231/2460.py" create mode 100644 "HomeWork/2.\354\210\230\355\225\231/2501.py" create mode 100644 "HomeWork/2.\354\210\230\355\225\231/2581.py" create mode 100644 "HomeWork/2.\354\210\230\355\225\231/2609.py" create mode 100644 "HomeWork/2.\354\210\230\355\225\231/2693.py" create mode 100644 "HomeWork/2.\354\210\230\355\225\231/3460(\355\213\200\353\246\274).py" diff --git "a/HomeWork/2.\354\210\230\355\225\231/10818.py" "b/HomeWork/2.\354\210\230\355\225\231/10818.py" new file mode 100644 index 0000000..e105579 --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/10818.py" @@ -0,0 +1,4 @@ +N = int(input()) +L = list(map(int, input().split())) +print(min(L), end=" ") +print(max(L)) \ No newline at end of file diff --git "a/HomeWork/2.\354\210\230\355\225\231/10870.py" "b/HomeWork/2.\354\210\230\355\225\231/10870.py" new file mode 100644 index 0000000..333d103 --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/10870.py" @@ -0,0 +1,8 @@ +L = [0, 1] + +n = int(input()) + +for i in range(2, n+1): + L.append(L[i-2] + L[i-1]) + +print(L[n]) diff --git "a/HomeWork/2.\354\210\230\355\225\231/1292(\355\213\200\353\246\274).py" "b/HomeWork/2.\354\210\230\355\225\231/1292(\355\213\200\353\246\274).py" new file mode 100644 index 0000000..31a877d --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/1292(\355\213\200\353\246\274).py" @@ -0,0 +1,11 @@ +L = [] +a, b = map(int, input().split()) + +for i in range(1000): + if i==7: + break + for j in range(i): + L.append(i) + +print(sum(L[a-1:b])) +# print(L[999]) \ No newline at end of file diff --git "a/HomeWork/2.\354\210\230\355\225\231/1978.py" "b/HomeWork/2.\354\210\230\355\225\231/1978.py" new file mode 100644 index 0000000..cdad9f1 --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/1978.py" @@ -0,0 +1,18 @@ +N= int(input()) +L= list(map(int, input().split())) + +c = 0 + +for n in L: + if n == 1: + continue + if n == 2 or n == 3: + c += 1 + else: + for i in range(2, int(n/2)+1): + if n % i == 0: + break + if i == int(n/2): + c += 1 + +print(c) \ No newline at end of file diff --git "a/HomeWork/2.\354\210\230\355\225\231/2309.py" "b/HomeWork/2.\354\210\230\355\225\231/2309.py" new file mode 100644 index 0000000..c126106 --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/2309.py" @@ -0,0 +1,21 @@ +L = [] +for i in range(9): + L.append(int(input())) +A = sum(L)-100 + +def DeleteFakeDwarf(L): + for i in range(8): + for j in range(1,9): + if j <= i: + continue + if L[i]+L[j] == A: + one, two = L[i], L[j] + L.remove(one) + L.remove(two) + return + +DeleteFakeDwarf(L) +L.sort() + +for i in L: + print(i) diff --git "a/HomeWork/2.\354\210\230\355\225\231/2460.py" "b/HomeWork/2.\354\210\230\355\225\231/2460.py" new file mode 100644 index 0000000..5c790b6 --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/2460.py" @@ -0,0 +1,9 @@ +current_passenger = 0 +max_passenger = 0 + +for _ in range(10): + o, i = map(int, input().split()) + current_passenger += (i - o) + if current_passenger > max_passenger: + max_passenger = current_passenger +print(max_passenger) \ No newline at end of file diff --git "a/HomeWork/2.\354\210\230\355\225\231/2501.py" "b/HomeWork/2.\354\210\230\355\225\231/2501.py" new file mode 100644 index 0000000..2884eda --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/2501.py" @@ -0,0 +1,12 @@ +N, K = map(int, input().split()) + +divisorList = [] + +for i in range(1, N+1): + if N % i == 0: + divisorList.append(i) + if len(divisorList) == K: + print(i) + break +if len(divisorList) < K: + print(0) \ No newline at end of file diff --git "a/HomeWork/2.\354\210\230\355\225\231/2581.py" "b/HomeWork/2.\354\210\230\355\225\231/2581.py" new file mode 100644 index 0000000..c2820fb --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/2581.py" @@ -0,0 +1,22 @@ +M= int(input()) +N= int(input()) + +L = [] + +for n in range(M, N+1): + if n == 1: + continue + if n == 2 or n == 3: + L.append(n) + else: + for i in range(2, int(n/2)+1): + if n % i == 0: + break + if i == int(n/2): + L.append(n) + +if len(L) == 0: + print(-1) +else: + print(sum(L)) + print(min(L)) \ No newline at end of file diff --git "a/HomeWork/2.\354\210\230\355\225\231/2609.py" "b/HomeWork/2.\354\210\230\355\225\231/2609.py" new file mode 100644 index 0000000..9c8b87d --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/2609.py" @@ -0,0 +1,17 @@ +# 최대공약수와 최소공배수 +# 유클리드호제법을 활용한 최대공약수 최소공배수 + +# 최대공약수 +def gcd(a, b): + while b>0: + a, b = b, a % b + return a + +# 최소공배수 +def lcm(a,b): + return a*b / gcd(a,b) + +a, b = map(int, input().split()) + +print(gcd(a,b)) +print(int(lcm(a,b))) diff --git "a/HomeWork/2.\354\210\230\355\225\231/2693.py" "b/HomeWork/2.\354\210\230\355\225\231/2693.py" new file mode 100644 index 0000000..6b2bdbe --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/2693.py" @@ -0,0 +1,7 @@ +#N번째 큰 수 +T = int(input()) + +for _ in range(T): + L = list(map(int, input().split())) + L.sort(reverse=True) + print(L[2]) \ No newline at end of file diff --git "a/HomeWork/2.\354\210\230\355\225\231/3460(\355\213\200\353\246\274).py" "b/HomeWork/2.\354\210\230\355\225\231/3460(\355\213\200\353\246\274).py" new file mode 100644 index 0000000..bef9536 --- /dev/null +++ "b/HomeWork/2.\354\210\230\355\225\231/3460(\355\213\200\353\246\274).py" @@ -0,0 +1,11 @@ +#이진수 + +T = int(input()) +n = int(input()) + +num = str(format(n,'b')) +reversed_num = "".join(reversed(num)) +print(num) +for i in range(len(reversed_num)): + if reversed_num[i] == "1": + print(i, end=" ") \ No newline at end of file From 0def735840c22879391c6d44e4af74c7d724832a Mon Sep 17 00:00:00 2001 From: jonggking <108375964+jonggking@users.noreply.github.com> Date: Sun, 16 Oct 2022 15:00:54 +0900 Subject: [PATCH 2/3] =?UTF-8?q?Update=201292(=ED=8B=80=EB=A6=BC).py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../1292(\355\213\200\353\246\274).py" | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git "a/HomeWork/2.\354\210\230\355\225\231/1292(\355\213\200\353\246\274).py" "b/HomeWork/2.\354\210\230\355\225\231/1292(\355\213\200\353\246\274).py" index 31a877d..64445a1 100644 --- "a/HomeWork/2.\354\210\230\355\225\231/1292(\355\213\200\353\246\274).py" +++ "b/HomeWork/2.\354\210\230\355\225\231/1292(\355\213\200\353\246\274).py" @@ -1,11 +1,7 @@ L = [] a, b = map(int, input().split()) - for i in range(1000): - if i==7: - break - for j in range(i): - L.append(i) + for j in range(i): + L.append(i) print(sum(L[a-1:b])) -# print(L[999]) \ No newline at end of file From e75494cb6d7d41d4037979f79c205bb7ecccd65c Mon Sep 17 00:00:00 2001 From: jonggking <108375964+jonggking@users.noreply.github.com> Date: Sun, 16 Oct 2022 15:01:16 +0900 Subject: [PATCH 3/3] =?UTF-8?q?Rename=201292(=ED=8B=80=EB=A6=BC).py=20to?= =?UTF-8?q?=201292.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2.\354\210\230\355\225\231/1292.py" | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "HomeWork/2.\354\210\230\355\225\231/1292(\355\213\200\353\246\274).py" => "HomeWork/2.\354\210\230\355\225\231/1292.py" (100%) diff --git "a/HomeWork/2.\354\210\230\355\225\231/1292(\355\213\200\353\246\274).py" "b/HomeWork/2.\354\210\230\355\225\231/1292.py" similarity index 100% rename from "HomeWork/2.\354\210\230\355\225\231/1292(\355\213\200\353\246\274).py" rename to "HomeWork/2.\354\210\230\355\225\231/1292.py"