6, boring

This commit is contained in:
basicbonobo 2023-12-06 06:27:45 +01:00
parent 4b0013ee1c
commit a612669e19
5 changed files with 30 additions and 1 deletions

View File

@ -8,4 +8,12 @@ day is visible until you solve it.
Most solutions output at most two lines, the answers to part 1 and 2; but some
provide more information in the form of e.g. graphics.
Run a solution by passing the puzzle input to the program.
Run a solution by passing the puzzle input to the program:
```
./two.bash < input2
```
or
```
./five.py -v < test5
```

2
input6 Normal file
View File

@ -0,0 +1,2 @@
Time: 47 98 66 98
Distance: 400 1213 1011 1540

6
scratch.py Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env python3
from useful import *
ns = numbers(open(0).read())
print(max(ns))

11
sixx.py Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env python3
from useful import *
ts, ds = [numbers(l) for l in lines(open(0))]
def wins(t, d):
return sum(i*(t-i) > d for i in range(t))
print(np.prod([wins(t, d) for (t, d) in zip(ts, ds)]))
print(wins(*[int(''.join(str(el) for el in ar)) for ar in (ts, ds)]))

2
test6 Normal file
View File

@ -0,0 +1,2 @@
Time: 7 15 30
Distance: 9 40 200