From 5175640b7c4c18ff8f8fe7dc3b943e01d17fdd55 Mon Sep 17 00:00:00 2001 From: heerucan Date: Thu, 30 Dec 2021 17:49:18 +0900 Subject: [PATCH] =?UTF-8?q?[#1]=20=EA=B7=B8=EB=A6=AC=EB=94=94=20=EC=95=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=EC=A6=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../3-1.py" | 10 ++++++++++ .../3-2.py" | 16 ++++++++++++++++ .../3-3.py" | 14 ++++++++++++++ .../3-4.py" | 14 ++++++++++++++ 4 files changed, 54 insertions(+) create mode 100644 "CodingTest/3.\352\267\270\353\246\254\353\224\224/3-1.py" create mode 100644 "CodingTest/3.\352\267\270\353\246\254\353\224\224/3-2.py" create mode 100644 "CodingTest/3.\352\267\270\353\246\254\353\224\224/3-3.py" create mode 100644 "CodingTest/3.\352\267\270\353\246\254\353\224\224/3-4.py" diff --git "a/CodingTest/3.\352\267\270\353\246\254\353\224\224/3-1.py" "b/CodingTest/3.\352\267\270\353\246\254\353\224\224/3-1.py" new file mode 100644 index 0000000..15b3fcc --- /dev/null +++ "b/CodingTest/3.\352\267\270\353\246\254\353\224\224/3-1.py" @@ -0,0 +1,10 @@ +# 거스름돈 +n = int(input()) +count = 0 +coinArray = [500, 100, 50, 10] + +for coin in coinArray: + count += n//coin # 거스름돈을 coin으로 나누고 나온 몫 + n %= coin # n을 coin으로 나눈 나머지를 n에 대입 + +print(count) \ No newline at end of file diff --git "a/CodingTest/3.\352\267\270\353\246\254\353\224\224/3-2.py" "b/CodingTest/3.\352\267\270\353\246\254\353\224\224/3-2.py" new file mode 100644 index 0000000..44fffe1 --- /dev/null +++ "b/CodingTest/3.\352\267\270\353\246\254\353\224\224/3-2.py" @@ -0,0 +1,16 @@ +# 큰 수의 법 + +n, m, k = map(int, input().split()) +result = 0 +data = list(map(int, input().split())) + +data.sort() + +while m > 0: + for i in range(k): + result += data[-1] + m -= 1 + result += data[-2] + m -= 1 + +print(result) diff --git "a/CodingTest/3.\352\267\270\353\246\254\353\224\224/3-3.py" "b/CodingTest/3.\352\267\270\353\246\254\353\224\224/3-3.py" new file mode 100644 index 0000000..b2c571d --- /dev/null +++ "b/CodingTest/3.\352\267\270\353\246\254\353\224\224/3-3.py" @@ -0,0 +1,14 @@ +# 숫자 카드 게임 + +# n : 행의 개수 +# m : 열의 개수 + +n, m = map(int, input().split()) +minData = [] +for i in range(n): + data = list(map(int, input().split())) + data.sort() + data[0] + minData.append(data[0]) +minData.sort() +print(minData[-1]) \ No newline at end of file diff --git "a/CodingTest/3.\352\267\270\353\246\254\353\224\224/3-4.py" "b/CodingTest/3.\352\267\270\353\246\254\353\224\224/3-4.py" new file mode 100644 index 0000000..e9803b0 --- /dev/null +++ "b/CodingTest/3.\352\267\270\353\246\254\353\224\224/3-4.py" @@ -0,0 +1,14 @@ +# 1이 될 때까지 + +n, k = map(int, input().split()) +count = 0 + +while n >= 1: + if n%k == 0: + n //= k + count += n//k + else: + n -= 1 + count += 1 + +print(count) \ No newline at end of file