Skip to content

Commit

Permalink
1이 될 때까지 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ezidayzi committed Dec 25, 2021
1 parent 22782f4 commit 2ec7fec
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CodingTestBook/Chapter 3/3-4.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 2ec7fec

Please sign in to comment.