From 799a3be74663866a1dae4f7ceec6e60616290cca Mon Sep 17 00:00:00 2001 From: Jiyun Kim Date: Wed, 14 Jun 2023 21:58:17 +0900 Subject: [PATCH 1/2] =?UTF-8?q?#34=20:=2015651=5FN=EA=B3=BC=20M(3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../15651_N\352\263\274 M(3).py" | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 "\354\235\264\355\213\260\354\247\200\354\234\244/15651_N\352\263\274 M(3).py" diff --git "a/\354\235\264\355\213\260\354\247\200\354\234\244/15651_N\352\263\274 M(3).py" "b/\354\235\264\355\213\260\354\247\200\354\234\244/15651_N\352\263\274 M(3).py" new file mode 100644 index 0000000..63a4cf4 --- /dev/null +++ "b/\354\235\264\355\213\260\354\247\200\354\234\244/15651_N\352\263\274 M(3).py" @@ -0,0 +1,15 @@ +import sys +input = sys.stdin.readline + +# dfs : 숫자를 cnt개 선택 후 arr[cnt]고르는 재귀함수 +def dfs(cnt): + if cnt == m: # m개를 모두 선택한 상태라면 더이상 숫자 선택X return시킴 + print(' '.join(map(str, arr))) + return + for i in range(1, n + 1): + arr[cnt] = i + dfs(cnt + 1) + +n, m = map(int, input().split()) +arr = [0 for _ in range(m)] # arr : 고른 m개의 숫자가 차례로 담기는 리스트 +dfs(0) # 아직 선택한 숫자 없음 cnt=0 \ No newline at end of file From bb7fd251bfd36c1f6d2d0204e671994d8b23176b Mon Sep 17 00:00:00 2001 From: Jiyun Kim Date: Wed, 14 Jun 2023 21:58:49 +0900 Subject: [PATCH 2/2] =?UTF-8?q?#34=20:=202839=5F=EC=84=A4=ED=83=95=20?= =?UTF-8?q?=EB=B0=B0=EB=8B=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4\355\203\225 \353\260\260\353\213\254.py" | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 "\354\235\264\355\213\260\354\247\200\354\234\244/2839_\354\204\244\355\203\225 \353\260\260\353\213\254.py" diff --git "a/\354\235\264\355\213\260\354\247\200\354\234\244/2839_\354\204\244\355\203\225 \353\260\260\353\213\254.py" "b/\354\235\264\355\213\260\354\247\200\354\234\244/2839_\354\204\244\355\203\225 \353\260\260\353\213\254.py" new file mode 100644 index 0000000..e35ba38 --- /dev/null +++ "b/\354\235\264\355\213\260\354\247\200\354\234\244/2839_\354\204\244\355\203\225 \353\260\260\353\213\254.py" @@ -0,0 +1,19 @@ +n = int(input()) + +if n % 5 == 0: # 5kg 로만 나눠 담을 때 + print(n // 5) +else: + p = 0 + while n > 0: + n -= 3 + p += 1 + if n % 5 == 0: # 3kg과 5kg를 조합해서 담을 수 있을 때 + p += n // 5 + print(p) + break + elif n == 1 or n == 2: # 3kg , 5kg로 나눠지지 않을 때 + print(-1) + break + elif n == 0: # 3kg로만 나눠 담을 때 + print(p) + break \ No newline at end of file