-
Notifications
You must be signed in to change notification settings - Fork 0
/
templ_main.go
54 lines (46 loc) · 1.16 KB
/
templ_main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
_ "embed"
"fmt"
"strconv"
"strings"
)
// go:embed input.txt
//
//go:embed inp.txt
var input string
// INFO print all [INFO] lines
const INFO = true
func main() {
// Split on DOS carrier return...
lines := strings.Split(strings.TrimSpace(input), "\r\n")
cntLines := len(lines)
// show sample input file for format check
if cntLines < 10 {
Infof("[INFO] Input file:\n%s\n", input)
for linenr, line := range lines {
Infof("[INFO] Line %d\t: %s\n", linenr, line)
}
}
// Check input number
Infof("[INFO] Read number of lines: %d\n", cntLines)
// - Solution part
// lines , cntLines
// sum
var sum int
for linenr, line := range lines {
cells := strings.Split(line, "x")
// Infof("[INFO] linenr [%1d]\t%s %s %s\n", linenr, cells[0])
x, _ := strconv.Atoi(cells[0])
// Infof("[INFO] linenr [%1d]\t%d %d %d\n", linenr, l, w, h)
// minSide := int(math.Min(math.Min(float64(l*w), float64(w*h)), float64(h*l)))
// sum +=
}
fmt.Printf("Total : %d\n", sum)
}
// Infof custom fmt.Printf for INFO lines
func Infof(format string, a ...any) {
if INFO {
fmt.Printf(format, a...)
}
}