this is the most bullshit code i've written but i dont care anymore

This commit is contained in:
aliasless 2019-12-08 18:08:45 -08:00
parent c984169df9
commit 37d93081db
3 changed files with 13 additions and 0 deletions

11
8/8.hs Normal file
View File

@ -0,0 +1,11 @@
import Data.List
import Data.List.Split
import Data.List.HT
count :: Eq a => a -> [a] -> Int
count a = foldr (\x sum -> if x == a then sum + 1 else sum) 0
main = do
layers <- readFile "input" >>= (\x -> pure $ sortBy (\a b -> compare (count '0' a) (count '0' b)) $ dropRev 1 $ (chunksOf (25 * 6) x))
putStrLn $ show $ (count '1' $ head layers) * (count '2' $ head layers)

1
8/answer Normal file
View File

@ -0,0 +1 @@
2440

1
8/input Normal file

File diff suppressed because one or more lines are too long