[Haskell-cafe] Slow IO or bad code?

Chaddaï Fouché chaddai.fouche at gmail.com
Thu Aug 9 12:10:52 EDT 2007


I get "Wrong answer" with the following code for the same problem...
Is there something strange in this code :


module Main where
import qualified Data.ByteString.Char8 as B

main =
    B.getLine >>=
    sequence_ . flip replicate hot . maybe 0 fst . B.readInt

hot = do
    B.getLine
    men <- B.getLine
    women <- B.getLine
    print
      $ sum
      $ zipWith (*)
            (map (maybe 0 fst . B.readInt) $ B.words men)
            (map (maybe 0 fst . B.readInt) $ B.words women)


???
I get the expected results with my tests.

-- 
Jedaï


More information about the Haskell-Cafe mailing list