From 2ec7fec5d225b7e5de28df6c66b78d7a74d92052 Mon Sep 17 00:00:00 2001 From: yoonseo Date: Sun, 26 Dec 2021 03:05:13 +0900 Subject: [PATCH] =?UTF-8?q?1=EC=9D=B4=20=EB=90=A0=20=EB=95=8C=EA=B9=8C?= =?UTF-8?q?=EC=A7=80=20(#1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CodingTestBook/Chapter 3/3-4.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 CodingTestBook/Chapter 3/3-4.py diff --git a/CodingTestBook/Chapter 3/3-4.py b/CodingTestBook/Chapter 3/3-4.py new file mode 100644 index 0000000..6b25e45 --- /dev/null +++ b/CodingTestBook/Chapter 3/3-4.py @@ -0,0 +1,14 @@ +n, k = map(int, input().split()) + +count = 0 + +while True: + if n == 1: + break + if n % k == 0: + n = n/k + else: + n = n - 1 + count += 1 + +print(count) \ No newline at end of file