Day 01 - 03 Dez. 2024

This commit is contained in:
2024-12-03 21:05:54 +01:00
parent 7c310e290e
commit 9c0c7f5df4
10 changed files with 2071 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
# AOC Day Script Day XX
# Date : 20XX.12.XX
# AOC Day Script Day 01
# Date : 2024.12.01
# Python Code
# Developer : David Bandeira
@@ -13,13 +13,37 @@ aocYear = identifyYear(sys.argv[0])
path = getPath2Data(aocDay,aocYear)
filename = getFilename2Data(aocDay)
listA=[]
listB=[]
def getData(data):
global listA
global listB
for dataRow in data:
valueData = dataRow.split(' ')
listA.append(int(valueData[0]))
listB.append(int(valueData[1]))
return
def taskA (data) -> int:
global listA
global listB
getData(data)
listA.sort()
listB.sort()
gameScoreA = 0
for step in range(len(listA)):
gameScoreA = gameScoreA + abs(listA[step]-listB[step])
return gameScoreA
def taskB (data) -> int:
global listA
global listB
gameScoreB = 0
for step in range(len(listA)):
gameScoreB = gameScoreB + abs(listA[step]*listB.count(listA[step]))
return gameScoreB
def task(task: int,data) -> int: