summaryrefslogtreecommitdiff
path: root/2019/2.hs
diff options
context:
space:
mode:
Diffstat (limited to '2019/2.hs')
-rw-r--r--2019/2.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/2019/2.hs b/2019/2.hs
new file mode 100644
index 0000000..51ecf12
--- /dev/null
+++ b/2019/2.hs
@@ -0,0 +1,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)