diff --git a/2023/day06/example.txt b/2023/day06/example.txt new file mode 100644 index 0000000..b39f49d --- /dev/null +++ b/2023/day06/example.txt @@ -0,0 +1,2 @@ +Time: 7 15 30 +Distance: 9 40 200 \ No newline at end of file diff --git a/2023/day06/src/part1.py b/2023/day06/src/part1.py new file mode 100644 index 0000000..89ddcde --- /dev/null +++ b/2023/day06/src/part1.py @@ -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) \ No newline at end of file diff --git a/2023/day06/src/part2.py b/2023/day06/src/part2.py new file mode 100644 index 0000000..89ddcde --- /dev/null +++ b/2023/day06/src/part2.py @@ -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) \ No newline at end of file