python-for-coding-test
python-for-coding-test copied to clipboard
p102 1이 될때까지 코드 질문있습니다.
whlie True: target=(n//k)*k result+=(n-target) n=target
이 부분을 whlie문 조건을 n>=k로 주어서 다음과 같이 작성해도 되는건가요?
나머지 연산을 이용하여 -1을 한번에 하여 count(result)를 해준후 k로 나누어 주는 것은 동일한 논리라고 생각합니다.
while n>=k: count+=n%k n-=n%k n//=k count+=1