adventofcode-2023/day_04/solution_04a.nim

17 lines
390 B
Nim
Raw Normal View History

import std/[cmdline, math, sequtils, strformat]
import common
var fn = if paramCount() > 0: paramStr(1) else: "input_04.txt"
var cards = parseInput(readFile(fn))
var result = sum(cards.mapIt(it.points))
echo &"Cards processed: {cards.len}"
echo &"Result: {result}"
case fn:
of "input_04.txt":
assert result == 18519
of "sample_input_04.txt":
assert result == 13