advent-of-code-2021/5/part2.go
2021-12-12 11:03:48 +01:00

26 lines
343 B
Go

package main
import (
"bufio"
"fmt"
"os"
)
func main() {
m := Matrix{}
s := bufio.NewScanner(os.Stdin)
for s.Scan() {
var x1, x2, y1, y2 int
_, _ = fmt.Sscanf(s.Text(), "%d,%d -> %d,%d", &x1, &y1, &x2, &y2)
m.DrawLine(x1, y1, x2, y2)
}
sum := 0
for _, count := range m {
if count > 1 {
sum++
}
}
fmt.Println(sum)
}