aboutsummaryrefslogtreecommitdiff
path: root/2020/one.nim
diff options
context:
space:
mode:
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)