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

26 lines
294 B
Go
Raw Normal View History

2021-12-01 15:16:01 +00:00
package main
import (
"bufio"
"fmt"
"math"
"os"
"strconv"
)
func main() {
count := 0
lastValue := math.MaxInt64
s := bufio.NewScanner(os.Stdin)
for s.Scan() {
value, _ := strconv.Atoi(s.Text())
if value > lastValue {
count++
}
lastValue = value
}
fmt.Println(count)
}