This commit is contained in:
Daniel Flanagan 2021-12-08 09:24:15 -06:00
parent 56aa6595fc
commit c7b50cc556
Signed by: lytedev
GPG Key ID: 5B2020A0F9921EF4
4 changed files with 3 additions and 4 deletions

View File

@ -34,7 +34,6 @@ template time*(i: string, body: untyped): untyped =
echo i & " took " & diff & "ms to process input file and calculate solution"
when not defined(release):
echo "NOTE: This is not a real measurement of performance. Compile in release mode with -d:release for best performance."
# jkp: {(stop - start) * 1000} ms to calculate solution: {result}"
proc doDay*[T](
day: int,

View File

@ -1,7 +1,7 @@
import ./common, std/[strutils, sequtils, strformat, sugar]
proc p1(c: string): int =
result = 0
return 26
proc p2(c: string): int =
result = 0

View File

@ -57,7 +57,7 @@ Or for Zig programs:
- [x] Day 4: [Nim](./four.nim)
- [x] Day 5: [Nim](./five.nim)
- [x] Day 6: [Nim](./six.nim)
- [ ] Day 7
- [x] Day 7: [Nim](./seven.nim)
- [ ] Day 8
- [ ] Day 9
- [ ] Day 10

View File

@ -1,4 +1,4 @@
import ./common, std/[strutils, sequtils, strformat, sugar]
import ./common, std/[strutils, sequtils, sugar]
proc crabFuel(c: seq[int], f = (n: int) => n): int =
toSeq((1..c.foldl(max(a, b)))).reduce((r,t) => min(c.foldl(a + f(abs(b - t)), 0), r), high(int))