Created
January 25, 2019 02:46
-
-
Save ar1a/aa0d1df891a717d72d05f0566579d050 to your computer and use it in GitHub Desktop.
This file contains 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
fac :: Int -> Int | |
fac = product . flip take [1..] | |
pascals :: Int -> [Int] | |
pascals n = | |
map (\r -> fac n `div` (fac r * fac (n - r))) [0..n] | |
main :: IO () | |
main = do | |
input <- getLine | |
putStrLn $ unlines . map ((unwords . map show) . pascals) . flip take [0..] . read $ input |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment