27 lines
571 B
Python
27 lines
571 B
Python
|
#!/usr/bin/env python
|
||
|
# 2023 - Advent Of Code 6 - part 2
|
||
|
|
||
|
import re
|
||
|
|
||
|
#file = 'input_example.txt'
|
||
|
file = 'input.txt'
|
||
|
|
||
|
races = []
|
||
|
|
||
|
with open(file, encoding="utf-8") as f:
|
||
|
times = re.findall(r"\s+(\d+)+\s?", f.readline())
|
||
|
distances = re.findall(r"\s+(\d+)+\s?", f.readline())
|
||
|
big_time = int("".join(times))
|
||
|
print(big_time)
|
||
|
big_dist = int("".join(distances))
|
||
|
print(big_dist)
|
||
|
|
||
|
res = 1
|
||
|
count = 0
|
||
|
for tpress in range(1, big_time):
|
||
|
nb = tpress * (big_time - tpress)
|
||
|
if nb > big_dist:
|
||
|
count += 1
|
||
|
# print(f'{tpress}: {nb}')
|
||
|
print(count)
|