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
|
422 Discussions
|
Please Login in order to post a comment
Here is my c++ solution, you can watch explanation here : https://youtu.be/RRJoL2vDmZM
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