๋ฐฑ์ค€ & ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค/greedy

[๋ฐฑ์ค€ 11047] [greedy] ๋™์ „ 0

_cactus 2021. 4. 17. 12:12
๋ฐ˜์‘ํ˜•

๋ฐฑ์ค€ 11047๋ฒˆ [๋™์ „ 0]

ํ’€์ด)

# ์ตœ์ข…์ œ์ถœ
lst = list(map(int,(input().split())))
a_lst = [int(input()) for _ in range(lst[0])]
k = lst[1]
cnt = 0
for i in range(len(a_lst)-1,-1,-1) :
    cnt += k//a_lst[i]
    k = k%a_lst[i]
print(cnt)
# ==> ๋ฉ”๋ชจ๋ฆฌ : 28776kb, ์‹œ๊ฐ„ : 76ms, ์ฝ”๋“œ๊ธธ์ด : 193B

 

728x90
๋ฐ˜์‘ํ˜•