17 lines
390 B
Nim
17 lines
390 B
Nim
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
|