Advent of Code 2020 https://adventofcode.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

8 lines
351 B

main = do
contents <- readFile "day1.txt"
let xs = map read $ lines contents
let [(i, j, k)] = [(i, j, k) | i <- [0..(length xs)-1],
j <- [0..i],
k <- [0..j],
(xs !! i) + (xs !! j) + (xs !! k) == 2020]
print $ (xs !! i) * (xs !! j) * (xs !! k)