怎么这么多天都是简单题,不多说了
class Solution:
def pickGifts(self, gifts: List[int], k: int) -> int:
gifts = [-gift for gift in gifts]
heapify(gifts)
for i in range(k):
heappush(gifts, -int(sqrt(-heappop(gifts))))
return -sum(gifts)