You are viewing a single comment's thread. Return to all comments →
You can trim it down just a bit more, though your method would probably be a bit clearer.
def luckBalance(k, contests): luck = 0 for lck, imp in sorted(contests, reverse=True): if k > 0 or not imp: luck += lck k -= imp else: luck -= lck return luck
Luck Balance
You are viewing a single comment's thread. Return to all comments →
You can trim it down just a bit more, though your method would probably be a bit clearer.