You are viewing a single comment's thread. Return to all comments →
Haskell
module Main where import Data.List (sortBy) solve :: [Int] -> Int solve cs = go 1 cs' 0 where cs' = sortBy (flip compare) cs go _ [] acc = acc go p (c : cs) acc = go (p * 2) cs (acc + p * c) main :: IO () main = getLine >> getLine >>= print . solve . map read . words
Seems like cookies are disabled on this browser, please enable them to open this website
Marc's Cakewalk
You are viewing a single comment's thread. Return to all comments →
Haskell