summaryrefslogtreecommitdiff
path: root/2019/2.hs
blob: 51ecf12d43d59c381a337b2bd044ef1a4030aa60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module Main where

import Control.Monad

import Input
import IntCode


main :: IO ()
main = do
    initMem <- parse . head <$> getInput 2
    let set12 a b mem = head mem : a : b : drop 3 mem
        run' a b = fst (run (set12 a b initMem) []) !! 0
    print (run' 12 2)
    forM_ [0..99] $ \a -> forM_ [0..99] $ \b ->
        when (run' a b == 19690720) $ print (100 * a + b)