Skip to content

Commit 6e0964b

Browse files
committed
style, formatting and new version of domino piling
1 parent 8f1c3e6 commit 6e0964b

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,9 @@ runhaskell sourcefile.hs
3838
[Team](src/team.hs) *getList*, fmap, filter, replicateM
3939

4040
[Team](src/team_.hs) point free notation, $ notation
41+
42+
[Domino piling](src/dominopiling.hs) *getList*, pattern matching, putStrLn
43+
44+
[Domino piling](src/dominopiling_.hs) interact, function currying, $ notation
45+
46+
[Domino piling](src/dominopiling__.hs) print, getLine, =<< operator

src/dominopiling.hs

+4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
-- https://codeforces.com/problemset/problem/50/A
2+
13
getList :: Read a => IO [a]
24
getList = fmap (map read . words) getLine
35

46
solve :: Int -> Int -> Int
57
solve m n = m * n `div` 2
68

9+
main :: IO ()
710
main = do
811
[m,n] <- getList
912
putStrLn . show $ solve m n
13+

src/dominopiling_.hs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- https://codeforces.com/problemset/problem/50/A
2+
3+
main :: IO ()
4+
main = do interact $ show . (`div` 2) . product . map read . words
5+

src/dominopiling__.hs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- https://codeforces.com/problemset/problem/50/A
2+
3+
main :: IO ()
4+
main = print . (`div` 2) . product . map read . words =<< getLine
5+

0 commit comments

Comments
 (0)