몇일 휴식기를 가지다 보니 집중력과 체력이 부족해 코드를 짜지는 못했습니다.
대신 간단한 수도 코드를 짜놓았고, 내일 이를 구현하고자 합니다.
#sort ascendent price, descendent weight
if weight < need
if price > iter.price
before = price = iter.price
else
if before == iter.price
price += iter.price
else
#price is always same or bigger than before.
before = price = iter.price
else
if price > iter.price && before != iter.price
before = price = iter.price
weight += iter.price
'개발일지 > Algorithm' 카테고리의 다른 글
20.17.16 개발일지 - 정육점(fin) (0) | 2020.07.16 |
---|---|
20.07.15 개발일지 - 정육점(fail) (0) | 2020.07.15 |
20.06.28 개발일지 - 정육점(실패) (0) | 2020.06.29 |
20.06.27 개발일지 - 謎紛芥索紀 (Large) (0) | 2020.06.27 |
20.06.27 개발일지 - Pizza Boxes (0) | 2020.06.27 |