feat: 2025 init + day1.1
This commit is contained in:
parent
95f74be063
commit
96b7dcec41
27 changed files with 44 additions and 0 deletions
21
2025/Day1/src/main.py
Normal file
21
2025/Day1/src/main.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
TOTAL_CLICKS = 100
|
||||
|
||||
if __name__ == '__main__':
|
||||
current = 50
|
||||
count = 0
|
||||
with open("input.txt", "r") as f:
|
||||
rotations = [{'direction': line[0], 'count': int(
|
||||
line[1:])} for line in f.readlines()]
|
||||
|
||||
for rotation in rotations:
|
||||
print(rotation)
|
||||
# Convert left to right to avoid negatives
|
||||
if rotation["direction"] == 'L':
|
||||
rotation["count"] = TOTAL_CLICKS - rotation["count"]
|
||||
|
||||
current = (current + rotation["count"]) % TOTAL_CLICKS
|
||||
|
||||
if current == 0:
|
||||
count += 1
|
||||
|
||||
print(count)
|
||||
Loading…
Add table
Add a link
Reference in a new issue