aboutsummaryrefslogtreecommitdiff
path: root/2020/one.nim
diff options
context:
space:
mode:
authorj-james2020-12-01 05:58:48 +0000
committerj-james2020-12-01 05:58:48 +0000
commit2ea995e6188c782afbd5eb85e4e5b51c9cdbaad8 (patch)
treed054822171ac728b281dd2ddbf358f2073fe1b40 /2020/one.nim
parentb23ea9372ae92b2add77213393041c62cba9a75b (diff)
Day One
Diffstat (limited to '2020/one.nim')
-rw-r--r--2020/one.nim11
1 files changed, 11 insertions, 0 deletions
diff --git a/2020/one.nim b/2020/one.nim
new file mode 100644
index 0000000..f136ed3
--- /dev/null
+++ b/2020/one.nim
@@ -0,0 +1,11 @@
+import os, strutils
+
+let input = paramStr(1)
+
+for one in lines(input):
+ for two in lines(input):
+ if parseInt(one) + parseInt(two) == 2020:
+ echo parseInt(one) * parseInt(two)
+ for three in lines(input):
+ if parseInt(one) + parseInt(two) + parseInt(three) == 2020:
+ echo parseInt(one) * parseInt(two) * parseInt(three)