aboutsummaryrefslogtreecommitdiff
path: root/2023/06
diff options
context:
space:
mode:
authorMarvin Borner2023-12-06 11:30:10 +0100
committerMarvin Borner2023-12-06 11:30:10 +0100
commit1b92e44bf7a4f88b9f842e61c008869fd2fb520e (patch)
treeaca3aecff1b269b2b89c0b4a974c23f707a01e63 /2023/06
parent5c51d1c7db9c281dac7071229295dec290ebc694 (diff)
Uff
Diffstat (limited to '2023/06')
-rw-r--r--2023/06/solve.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/2023/06/solve.py b/2023/06/solve.py
new file mode 100644
index 0000000..8c92b03
--- /dev/null
+++ b/2023/06/solve.py
@@ -0,0 +1,18 @@
+L = [
+ [int(race) for race in l.strip().split(" ") if race and race[0].isdigit()]
+ for l in open("input").readlines()
+]
+
+
+res = 1
+for i in range(len(L[0])):
+ winning = 0
+ time, best = L[0][i], L[1][i]
+ for hold in range(1, time):
+ dist = hold * (time - hold)
+ if dist > best:
+ winning += 1
+ res *= winning
+print(res)
+
+# for part 2, just join the numbers in the input :)