From 297a5129f50934a4b66c79c764ab3cefe149804d Mon Sep 17 00:00:00 2001 From: Reoyl Date: Wed, 20 Apr 2022 22:05:57 +0900 Subject: [PATCH 1/7] =?UTF-8?q?17910=20JointAttack=20=EC=A0=95=EC=9E=AC?= =?UTF-8?q?=ED=99=8D=20-=20=EC=96=B4=EB=94=94=EA=B0=80=20=ED=8B=80?= =?UTF-8?q?=EB=A6=B0=20=EA=B1=B8=EA=B9=8C=EC=9A=94=E3=85=9C=E3=85=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- week1/17910jointAttack/solution.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/week1/17910jointAttack/solution.py b/week1/17910jointAttack/solution.py index e69de29..5b0a18e 100644 --- a/week1/17910jointAttack/solution.py +++ b/week1/17910jointAttack/solution.py @@ -0,0 +1,10 @@ +def jointAttack(array): + if (len(array)<=1): + return array.pop() + + return array.pop(0) + 1 / (jointAttack(array)) + +N = int(input()) +array = [int(_) for _ in input().split()] + +print(jointAttack(array)) \ No newline at end of file From 0ef2b38959840e38911e3a437de817655d35f386 Mon Sep 17 00:00:00 2001 From: Reoyl Date: Thu, 21 Apr 2022 09:30:49 +0900 Subject: [PATCH 2/7] 1934 Least Common Multiplier Solved by using Greatest Common Divisor --- .../solution.py" | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git "a/week1/1934\354\265\234\354\206\214\352\263\265\353\260\260\354\210\230/solution.py" "b/week1/1934\354\265\234\354\206\214\352\263\265\353\260\260\354\210\230/solution.py" index e69de29..c636517 100644 --- "a/week1/1934\354\265\234\354\206\214\352\263\265\353\260\260\354\210\230/solution.py" +++ "b/week1/1934\354\265\234\354\206\214\352\263\265\353\260\260\354\210\230/solution.py" @@ -0,0 +1,12 @@ +def gcd(arr): + while arr[1]>0: + arr[0], arr[1] = arr[1], arr[0]%arr[1] + return arr[0] + +def lcm(arr): + return arr[0]*arr[1] // gcd(arr) + +test_case = [list(map(int, input().split())) for _ in range(int(input()))] + +for case in test_case: + print(lcm(case)) \ No newline at end of file From 9745b208a3583414466168011ae4cd2e07874ce3 Mon Sep 17 00:00:00 2001 From: Reoyl Date: Thu, 21 Apr 2022 09:34:56 +0900 Subject: [PATCH 3/7] nothing on master --- week1/17910jointAttack/solution.py | 10 ---------- .../solution.py" | 12 ------------ 2 files changed, 22 deletions(-) diff --git a/week1/17910jointAttack/solution.py b/week1/17910jointAttack/solution.py index 5b0a18e..e69de29 100644 --- a/week1/17910jointAttack/solution.py +++ b/week1/17910jointAttack/solution.py @@ -1,10 +0,0 @@ -def jointAttack(array): - if (len(array)<=1): - return array.pop() - - return array.pop(0) + 1 / (jointAttack(array)) - -N = int(input()) -array = [int(_) for _ in input().split()] - -print(jointAttack(array)) \ No newline at end of file diff --git "a/week1/1934\354\265\234\354\206\214\352\263\265\353\260\260\354\210\230/solution.py" "b/week1/1934\354\265\234\354\206\214\352\263\265\353\260\260\354\210\230/solution.py" index c636517..e69de29 100644 --- "a/week1/1934\354\265\234\354\206\214\352\263\265\353\260\260\354\210\230/solution.py" +++ "b/week1/1934\354\265\234\354\206\214\352\263\265\353\260\260\354\210\230/solution.py" @@ -1,12 +0,0 @@ -def gcd(arr): - while arr[1]>0: - arr[0], arr[1] = arr[1], arr[0]%arr[1] - return arr[0] - -def lcm(arr): - return arr[0]*arr[1] // gcd(arr) - -test_case = [list(map(int, input().split())) for _ in range(int(input()))] - -for case in test_case: - print(lcm(case)) \ No newline at end of file From 68c4270c3481a8fbd07d138063d73fd088af30a4 Mon Sep 17 00:00:00 2001 From: CHOCO Date: Sun, 8 May 2022 21:14:29 +0900 Subject: [PATCH 4/7] =?UTF-8?q?=EB=93=A3=EB=B3=B4=EC=9E=A1=20solved?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../solution.py" | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git "a/week1/3986\354\242\213\354\235\200\353\213\250\354\226\264/solution.py" "b/week1/3986\354\242\213\354\235\200\353\213\250\354\226\264/solution.py" index e69de29..1781990 100644 --- "a/week1/3986\354\242\213\354\235\200\353\213\250\354\226\264/solution.py" +++ "b/week1/3986\354\242\213\354\235\200\353\213\250\354\226\264/solution.py" @@ -0,0 +1,13 @@ +def main(): + n, m = map(int, input().split()) + a = set([input() for _ in range(n)]) + b = set([input() for _ in range(m)]) + answer = list(a & b) + answer.sort() + + print(len(answer)) + for ans in answer: + print(ans) + +if __name__=='__main__': + main() \ No newline at end of file From 3307f6cac0dc175266d34031e9415b7735d4de1c Mon Sep 17 00:00:00 2001 From: CHOCO Date: Sun, 8 May 2022 21:26:52 +0900 Subject: [PATCH 5/7] =?UTF-8?q?=EB=93=A3=EB=B3=B4=EC=9E=A1=20Solved?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../solution.py" | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git "a/week2/1764\353\223\243\353\263\264\354\236\241/solution.py" "b/week2/1764\353\223\243\353\263\264\354\236\241/solution.py" index e69de29..e178dce 100644 --- "a/week2/1764\353\223\243\353\263\264\354\236\241/solution.py" +++ "b/week2/1764\353\223\243\353\263\264\354\236\241/solution.py" @@ -0,0 +1,13 @@ +def main(): + n, m = map(int, input().split()) + a = set([input() for _ in range(n)]) + b = set([input() for _ in range(m)]) + answer = list(a & b) + answer.sort() + + print(len(answer)) + for ans in answer: + print(ans) + +if __name__=='__main__': + main() From ce1b0066a81a89d81de054cc34b53901d965d53e Mon Sep 17 00:00:00 2001 From: CHOCO Date: Sun, 8 May 2022 21:32:02 +0900 Subject: [PATCH 6/7] 3986 amended --- .../solution.py" | 13 ------------- 1 file changed, 13 deletions(-) diff --git "a/week1/3986\354\242\213\354\235\200\353\213\250\354\226\264/solution.py" "b/week1/3986\354\242\213\354\235\200\353\213\250\354\226\264/solution.py" index 1781990..e69de29 100644 --- "a/week1/3986\354\242\213\354\235\200\353\213\250\354\226\264/solution.py" +++ "b/week1/3986\354\242\213\354\235\200\353\213\250\354\226\264/solution.py" @@ -1,13 +0,0 @@ -def main(): - n, m = map(int, input().split()) - a = set([input() for _ in range(n)]) - b = set([input() for _ in range(m)]) - answer = list(a & b) - answer.sort() - - print(len(answer)) - for ans in answer: - print(ans) - -if __name__=='__main__': - main() \ No newline at end of file From c5f433459195d91f1efa7498e589aa1e9c9f5af9 Mon Sep 17 00:00:00 2001 From: CHOCO Date: Thu, 19 May 2022 07:27:09 +0900 Subject: [PATCH 7/7] zero solved using stack --- "week2/10773\354\240\234\353\241\234/solution.py" | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git "a/week2/10773\354\240\234\353\241\234/solution.py" "b/week2/10773\354\240\234\353\241\234/solution.py" index e69de29..dd09f82 100644 --- "a/week2/10773\354\240\234\353\241\234/solution.py" +++ "b/week2/10773\354\240\234\353\241\234/solution.py" @@ -0,0 +1,15 @@ +def main(): + N = int(input()) + stack = [] + + for i in range(N): + n = int(input()) + if (n==0): + stack.pop() + continue + stack.append(n) + + print(sum(stack)) + +if __name__=='__main__': + main() \ No newline at end of file