add: day06
This commit is contained in:
parent
7a06186409
commit
677f8350a0
2
2023/day06/example.txt
Normal file
2
2023/day06/example.txt
Normal file
@ -0,0 +1,2 @@
|
||||
Time: 7 15 30
|
||||
Distance: 9 40 200
|
19
2023/day06/src/part1.py
Normal file
19
2023/day06/src/part1.py
Normal file
@ -0,0 +1,19 @@
|
||||
text: str = open("input.txt", "r").read()
|
||||
|
||||
_value: int = 1
|
||||
|
||||
lines = text.splitlines()
|
||||
|
||||
times = [46857582]
|
||||
distances = [208141212571410]
|
||||
|
||||
for start in range(0, len(times)):
|
||||
distance = distances[start]
|
||||
time = times[start]
|
||||
value = 0
|
||||
for i in range(0, time):
|
||||
if ((time - i) * i > distance):
|
||||
value += 1
|
||||
_value *= value
|
||||
|
||||
print(_value)
|
19
2023/day06/src/part2.py
Normal file
19
2023/day06/src/part2.py
Normal file
@ -0,0 +1,19 @@
|
||||
text: str = open("input.txt", "r").read()
|
||||
|
||||
_value: int = 1
|
||||
|
||||
lines = text.splitlines()
|
||||
|
||||
times = [46857582]
|
||||
distances = [208141212571410]
|
||||
|
||||
for start in range(0, len(times)):
|
||||
distance = distances[start]
|
||||
time = times[start]
|
||||
value = 0
|
||||
for i in range(0, time):
|
||||
if ((time - i) * i > distance):
|
||||
value += 1
|
||||
_value *= value
|
||||
|
||||
print(_value)
|
Loading…
Reference in New Issue
Block a user