started 05

This commit is contained in:
Simon Ziegler
2025-12-05 17:02:09 +01:00
parent 642045825f
commit c870a79ba3
3 changed files with 1242 additions and 0 deletions

1175
05/input Normal file

File diff suppressed because it is too large Load Diff

56
05/main.go Normal file
View File

@@ -0,0 +1,56 @@
package main
import (
"fmt"
"strconv"
"strings"
"git.z1glr.de/advent-of-code-2025/pkg/aoc"
)
type Range struct {
From, To int
}
func parseRange(r string) Range {
parts := strings.Split(r, "-")
var err error
rng := Range{}
if rng.From, err = strconv.Atoi(parts[0]); err != nil {
panic(err)
}
if rng.To, err = strconv.Atoi(parts[1]); err != nil {
panic(err)
}
return rng
}
func main() {
rows := aoc.ReadFileRows(true)
fmt.Println(rows)
ranges := []Range{}
var idsStartIndex int
for ii, rr := range rows {
if rr == "" {
idsStartIndex = ii + 1
break
} else {
ranges = append(ranges, parseRange(rr))
}
}
ids := make([]int, len(rows)-idsStartIndex)
for ii, rr := range rows[idsStartIndex:] {
}
fmt.Println(ranges)
fmt.Println(ids)
}

11
05/test Normal file
View File

@@ -0,0 +1,11 @@
3-5
10-14
16-20
12-18
1
5
8
11
17
32