advent-of-code-2021/1/part1.go
2021-12-01 16:16:01 +01:00

25 lines
294 B
Go

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)
}