blob: c7e9d027f3ff33b9319e78ef2bf24122ce79f2a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
module Main where
import Data.List (find)
import Data.Maybe (fromJust)
import qualified Data.Set as Set
import Input
main :: IO ()
main = do
input <- map read <$> getInput 1 :: IO [Int]
let num1 = fromJust (find ((`Set.member` Set.fromList input) . (2020 -)) input)
print (num1 * (2020 - num1))
let pair = snd (fromJust (find ((`Set.member` Set.fromList input) . (2020 -) . fst)
[(a + b, (a, b)) | a <- input, b <- input]))
print (fst pair * snd pair * (2020 - fst pair - snd pair))
|