2021-11-30 23:51:56 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bufio"
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
start := time.Now()
|
|
|
|
partOne()
|
|
|
|
duration := time.Since(start)
|
|
|
|
partTwo()
|
|
|
|
duration2 := time.Since(start)
|
|
|
|
fmt.Printf("p1: %s, p2: %s\n", duration, duration2-duration)
|
|
|
|
}
|
|
|
|
|
2021-12-01 00:14:48 +00:00
|
|
|
func makeScanner(test bool) *bufio.Scanner {
|
|
|
|
var f *os.File
|
|
|
|
if test {
|
|
|
|
f, _ = os.Open("inputs/testinput")
|
|
|
|
} else {
|
|
|
|
f, _ = os.Open("inputs/input")
|
|
|
|
}
|
2021-11-30 23:51:56 +00:00
|
|
|
reader := bufio.NewReader(f)
|
2021-12-01 00:14:48 +00:00
|
|
|
return bufio.NewScanner(reader)
|
|
|
|
}
|
|
|
|
|
|
|
|
func partOne() {
|
|
|
|
scanner := makeScanner(false)
|
2021-11-30 23:51:56 +00:00
|
|
|
|
|
|
|
for scanner.Scan() {
|
|
|
|
// line := scanner.Text()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func partTwo() {
|
2021-12-01 00:14:48 +00:00
|
|
|
scanner := makeScanner(false)
|
2021-11-30 23:51:56 +00:00
|
|
|
|
|
|
|
for scanner.Scan() {
|
|
|
|
// line := scanner.Text()
|
|
|
|
}
|
|
|
|
}
|