보안을 그리다, 훈이

[Baekjoon/Python3] 17174번 전체 계산 횟수 본문

Programming/Python & Data Structures

[Baekjoon/Python3] 17174번 전체 계산 횟수

HooNeee 2020. 12. 8. 18:02

[Baekjoon/Python3] 17174번 전체 계산 횟수

 

www.acmicpc.net/problem/17174

 

17174번: 전체 계산 횟수

첫 번째 줄에 환전한 금액 N과 묶음의 크기 M이 주어진다. (2 ≤ N ≤ 100,000, 2 ≤ M ≤ N)

www.acmicpc.net

 

n, m = map(int, input().split())
cnt = n
while n // m:
    cnt += n // m
    n //= m
print(cnt)
Comments