We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Greedy
- Marc's Cakewalk
- Discussions
Marc's Cakewalk
Marc's Cakewalk
Sort by
recency
|
420 Discussions
|
Please Login in order to post a comment
n = int(input()) c = list(map(int,input().split())) sum1 = 0 c.sort(reverse=True) i = 0 for j in c: sum1+=(2**i)*j i+=1 print(sum1)
UIUA Solution
python
Sort the list, take the last element of the list each time, to get the least possible total of miles. Decrement your counter as you go.
return result; }