본문 바로가기
Programming/알고리즘

그리디 알고리즘

by 구튼탁 2020. 8. 25.
728x90
N = 25
k = 5

remainder = N % k 
N = N - remainder

while True:

  N = N / k
  remainder += 1

  if N == 1:
    break

print(remainder)

그리디 알고리즘 : 현재 상황에서 가장 좋은 것만 고르는 방법

 

 

728x90

'Programming > 알고리즘' 카테고리의 다른 글

[greedy] - 백준 11399번 ATM  (0) 2020.09.16
백준 - RGB 거리, python  (0) 2020.09.07
백준 - 1로 만들기, DP / python3  (0) 2020.09.06
implementation, 구현  (0) 2020.08.25
Algorithm - Recursion  (0) 2020.08.07

댓글