Created
May 23, 2018 07:06
-
-
Save karlbright/3d9129fae2fed2c5ee74ef942fc5225e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
solve :: [Int] -> [Int] | |
solve (s:t:a:b:m:_:rest) = [as, os] | |
where as = length $ filter (\x -> s <= x && x <= t) $ map (\x -> x + a) $ take m rest | |
os = length $ filter (\x -> s <= x && x <= t) $ map (\x -> x + b) $ drop m rest | |
main = interact $ unlines . map show . solve . map read . words |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment