Cake ProblemGiven a circular cake, using just 4 straight vertical knife cuts, which number is the maximum possible of pieces you can create? Haskell:
module Main where
main :: IO ()
main = mapM_ print $ zip a (map cake a)
where a = [1..10]
cake :: Integral a => a > a
cake n = (n^2+n+2)`div`2


0hc.net © 20012014 Harald Wolfsgruber  