This commit is contained in:
parent
3c900f39ee
commit
ed9e80e7c9
1 changed files with 26 additions and 0 deletions
26
2023/6/6_2.py
Normal file
26
2023/6/6_2.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/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)
|
Loading…
Reference in a new issue