redo project naming structure

This commit is contained in:
Rupus Reinefjord 2022-12-03 00:32:28 +01:00
parent 50fa518ffc
commit 9a27d6d376

18
2022/day01/day01.nim Normal file
View file

@ -0,0 +1,18 @@
import std/[algorithm, math, os, strutils, sugar]
let lst = stdin.readAll().strip()
let elves = lst.split("\n\n")
var totals = collect:
for elf in elves:
let elfInts = collect:
for cal in elf.split("\n"):
parseInt(cal)
sum(elfInts)
totals.sort(order = Descending)
if paramStr(1) == "1":
echo totals[0]
elif paramStr(1) == "2":
echo sum(totals[0..2])