python-for-coding-test icon indicating copy to clipboard operation
python-for-coding-test copied to clipboard

챕터3 그리디 4번 1이 될 때까지 문제 질문 있습니다

Open PJM03 opened this issue 5 years ago • 0 comments

제가 복잡도를 계산하는 방법을 아직 완전히 익히지 못해서...ㅠㅠ 제가 짠 코드가 실제 코딩테스트에서 사용했을 때 문제가 없을까요?...

def caculate(n, k, count=0):
	if n == 1:
		return count
	if n % k == 0:
		return caculate(n/k, k, count+1)
	return caculate(n-1, k, count+1)
N, K = map(int, input().split())
print(caculate(N, K))

PJM03 avatar Nov 04 '20 06:11 PJM03