01: part1

This commit is contained in:
ptrcnull 2021-12-01 16:16:01 +01:00
commit 4779e181a2
3 changed files with 2050 additions and 0 deletions

2000
1/input Normal file

File diff suppressed because it is too large Load diff

25
1/part1.go Normal file
View file

@ -0,0 +1,25 @@
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)
}

25
1/part2.go Normal file
View file

@ -0,0 +1,25 @@
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)
}