백준 동전0 python
![[백준 11047] 동전0 - python](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FX5UIF%2Fbtq3U64fWmx%2FAAAAAAAAAAAAAAAAAAAAAKv1h1gStp90cpKD5GG7LzkpMn76zOw-zuHH6VKtApIn%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DpTisJlTY8nLaZzVyvrnjab5EZ0I%253D)
[백준 11047] 동전0 - python
아이디어 입력받는 동전을 내림차순으로 정렬한 뒤, coin리스트를 돈다. 입력받은 돈 K 가 현재 coin보다 작을 경우에는 pass K의 몫과 나머지를 구한 후에 각각 result와 K값에 넣어준다 N, K = map(int, input().split()) coin = [] for _ in range(N): coin.append(int(input())) result = 0 # 코인최소개수 coin.sort(reverse=True) for i in coin: if i > K: continue if K == 0: break result += K//i K %= i print(result)