From 297a5129f50934a4b66c79c764ab3cefe149804d Mon Sep 17 00:00:00 2001 From: Reoyl Date: Wed, 20 Apr 2022 22:05:57 +0900 Subject: [PATCH 1/4] =?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/4] 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/4] 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 c6414ccadb5880b0cc58678e32b7056697718c92 Mon Sep 17 00:00:00 2001 From: Reoyl Date: Thu, 28 Apr 2022 07:47:18 +0900 Subject: [PATCH 4/4] =?UTF-8?q?20301=20=EB=B0=98=EC=A0=84=EC=9A=94?= =?UTF-8?q?=EC=84=B8=ED=91=B8=EC=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../solution.py" | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git "a/week1/20301\353\260\230\354\240\204\354\232\224\354\204\270\355\221\270\354\212\244/solution.py" "b/week1/20301\353\260\230\354\240\204\354\232\224\354\204\270\355\221\270\354\212\244/solution.py" index e69de29..394b564 100644 --- "a/week1/20301\353\260\230\354\240\204\354\232\224\354\204\270\355\221\270\354\212\244/solution.py" +++ "b/week1/20301\353\260\230\354\240\204\354\232\224\354\204\270\355\221\270\354\212\244/solution.py" @@ -0,0 +1,20 @@ +from collections import deque + +n, k, m = map(int, input().split()) +q = deque(list(range(1, n+1))) +killed = [] +flag = 'right' + +while q: + if(flag=='right'): + for _ in range(k - 1): + q.append(q.popleft()) + else: + for _ in range(k): + q.insert(0, q.pop()) + killed.append(q.leftpop()) + + if (len(killed)%m==0): + flag='left' if flag=='right' else 'right' + +print(*killed, sep='\n') \ No newline at end of file