the day10 of shame

This commit is contained in:
Nico 2020-12-10 18:40:13 +00:00
parent ba6e3749f5
commit b4665b5bb4
2 changed files with 9 additions and 3 deletions

View File

@ -6,7 +6,7 @@ import (
"math" "math"
"strconv" "strconv"
"strings" "strings"
"io/ioutil" //"io/ioutil"
) )
func main() { func main() {
@ -41,7 +41,11 @@ func main() {
if g == 1 { if g == 1 {
run += 1 run += 1
} else { } else {
skippable += (run-1) if run == 2 {
skippable += 2
} else {
skippable += (run-1)
}
run = 0 run = 0
} }
} }
@ -49,5 +53,5 @@ func main() {
fmt.Println(gaps) fmt.Println(gaps)
fmt.Println(skippable) fmt.Println(skippable)
fmt.Println(ints) fmt.Println(ints)
fmt.Printf("Part 2: %f\n", math.Pow(2, float64(skippable))-1) // All possible combinations for n, according to wikipedia fmt.Printf("Part 2: %f\n", math.Pow(2, float64(skippable))) // All possible combinations for n, according to wikipedia
} }

View File

@ -1,3 +1,5 @@
I never solved this, I cheated. Here's the notes I made while failing.
######################################################
if the one before and the one after an adapter can connect, that adapter can be dropped if the one before and the one after an adapter can connect, that adapter can be dropped
find all these possible drops find all these possible drops
number of possible combinations of these drops number of possible combinations of these drops