RosettaCodeData/Task/Department-numbers/Haskell/department-numbers-7.hs
2023-07-01 13:44:08 -04:00

10 lines
284 B
Haskell

import Control.Monad (guard)
options :: Int -> Int -> Int -> [(Int, Int, Int)]
options lo hi total =
let ds = [lo .. hi]
in do x <- filter even ds
y <- filter (/= x) ds
let z = total - (x + y)
guard $ y /= z && lo <= z && z <= hi
return (x, y, z)