Day1
This commit is contained in:
parent
4e87850e53
commit
bf2354d2ee
9
2021/day01/day01.hs
Normal file
9
2021/day01/day01.hs
Normal file
@ -0,0 +1,9 @@
|
||||
main :: IO ()
|
||||
main = do
|
||||
input <- map read . lines <$> readFile "input"
|
||||
print $ day1 input
|
||||
print $ day1 $ zipWith3 (\x y z->x+y+z) input (tail input) (tail $ tail input)
|
||||
|
||||
|
||||
day1 :: [Int] -> Int
|
||||
day1 a = sum $ map fromEnum $ zipWith (<) a (tail a)
|
2000
2021/day01/input
Normal file
2000
2021/day01/input
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user