advent-of-code-2021/5/part2.go

27 lines
343 B
Go
Raw Normal View History

2021-12-05 06:15:59 +00:00
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)
}