aoc/aoc2015/day02.go

22 lines
387 B
Go

package aoc2015
import (
"aoc/internal/utility"
"fmt"
)
func day02() {
in := utility.GetLines("input/2015/02")
var h, w, l, p1, p2 int
for _, line := range in {
_, err := fmt.Sscanf(line, "%dx%dx%d", &l, &w, &h)
utility.E(err)
p1 += 2*l*w + 2*w*h + 2*h*l + min(l*w, min(w*h, h*l))
p2 += l*w*h + min(l*2+w*2, min(w*2+h*2, h*2+l*2))
}
fmt.Println(p1)
fmt.Println(p2)
}