2025 - Day 1 part 1
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
parent
5591704d14
commit
18ad109e33
3 changed files with 4533 additions and 0 deletions
24
2025/1/1.py
Normal file
24
2025/1/1.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env python
|
||||
# 2025 - Advent Of Code 1
|
||||
|
||||
# file = 'input_example.txt'
|
||||
file = 'input.txt'
|
||||
|
||||
dial = 50
|
||||
count = 0
|
||||
with open(file, encoding="utf-8") as f:
|
||||
for line in f.readlines():
|
||||
direction = line[0]
|
||||
distance = int(line[1:])
|
||||
# print(f'{direction=}, {distance=}')
|
||||
if direction == 'L':
|
||||
dial -= distance
|
||||
print(f'Left {dial=}')
|
||||
elif direction == 'R':
|
||||
dial += distance
|
||||
print(f'Right {dial=}')
|
||||
dial = dial % 100
|
||||
if dial == 0:
|
||||
count += 1
|
||||
|
||||
print(count)
|
||||
4499
2025/1/input.txt
Normal file
4499
2025/1/input.txt
Normal file
File diff suppressed because it is too large
Load diff
10
2025/1/input_example.txt
Normal file
10
2025/1/input_example.txt
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
L68
|
||||
L30
|
||||
R48
|
||||
L5
|
||||
R60
|
||||
L55
|
||||
L1
|
||||
L99
|
||||
R14
|
||||
L82
|
||||
Loading…
Reference in a new issue