추가 'Greedy Algorithm'

This commit is contained in:
kim_yubin 2018-10-26 19:04:21 +09:00
parent 81df6d9411
commit c41f4d35eb
1 changed files with 16 additions and 0 deletions

16
Greedy Algorithm Normal file
View File

@ -0,0 +1,16 @@
a=[50, 5, 2]
an=56
bn=54
t=0
ans=[]
while 1:
if an < a[t]:
break
while an>a[t]:
ans.append(a[t])
an = an - a[t]
t += 1
print(an)
print(ans)