Submission #230463


Source Code Expand

import Control.Applicative

main = do
  [a,b] <- words <$> getLine
  xx <- (map read . words) <$> getLine
  let c = reverse (int2bin (read b::Int))
  let s = getZipList $ (*) <$> ZipList c <*> ZipList xx
  mapM_ print $ sum s

int2bin 0 =  []
int2bin n =  n `mod` 2 : int2bin (n `div` 2)

Submission Info

Submission Time
Task B - 価格の合計
User maeken2010
Language Haskell (GHC 7.4.1)
Score 0
Code Size 297 Byte
Status CE

Compile Error

Main.hs:8:21:
    Couldn't match expected type `[a0]' with actual type `Int'
    Expected type: [[a0]]
      Actual type: [Int]
    In the first argument of `sum', namely `s'
    In the second argument of `($)', namely `sum s'