first commit

This commit is contained in:
2025-12-04 15:07:43 +03:00
commit 7a06945ca4
9 changed files with 720 additions and 0 deletions

53
2025/day01/secret_day1.py Normal file
View File

@@ -0,0 +1,53 @@
# import math
# with open("input.txt", "r") as file:
# input = file.read().splitlines()
# count_0 = 0
# count_100 = 0
# start = 50
# step = 100
# # input = [
# # "R50",
# # "R5",
# # "L200",
# # "R95",
# # ]
# # input = [
# # "L68",
# # "L30",
# # "R48",
# # "L5",
# # "R60",
# # "L55",
# # "L1",
# # "L99",
# # "R14",
# # "L82",
# # ]
# last_value = start
# count_diff = 0
# for row in input:
# dig = int(math.fmod(int(row[1:]), step))
# count_100 += int(math.floor(int(row[1:]) / step))
# start += -dig if "L" in row else dig
# start_new_temp = int(math.fmod((step + start if start < 0 else start), step))
# if start_new_temp < 0:
# start_new = 100 + start_new_temp
# else:
# start_new = start_new_temp
# count_0 += int(start_new == 0)
# if "L" in row and last_value + -dig < 0 and last_value != 0:
# count_diff += 1
# elif "R" in row and last_value + dig > step:
# count_diff += 1
# print(f"row: {row:<4}, dig: {dig:<4}, last_value: {last_value:<5}, start: {start:<4}, start_new: {start_new:<3}, count_diff: {count_diff}")
# last_value = (start_new)
# # print("="*100)
# print(f"count_0 = {count_0}, count_100 = {count_100}, count_diff = {count_diff}, Сумма: {count_0 + count_100 + count_diff}")