Compare commits
No commits in common. '4e60e583be219312f6aad3ad0abedf6192d22d49' and '90029028be75b305327067b9837ef5fc566ace4d' have entirely different histories.
4e60e583be
...
90029028be
8 changed files with 2 additions and 3601 deletions
@ -1,36 +0,0 @@ |
|||||||
lines = [i for i in open("input.txt", 'r').read().splitlines()] |
|
||||||
|
|
||||||
sum = 0 |
|
||||||
sum2 = 0 |
|
||||||
|
|
||||||
for l in lines: |
|
||||||
match(l): |
|
||||||
case "A X": |
|
||||||
sum += 4 |
|
||||||
sum2 += 3 |
|
||||||
case "A Y": |
|
||||||
sum += 8 |
|
||||||
sum2 += 4 |
|
||||||
case "A Z": |
|
||||||
sum += 3 |
|
||||||
sum2 += 8 |
|
||||||
case "B X": |
|
||||||
sum += 1 |
|
||||||
sum2 += 1 |
|
||||||
case "B Y": |
|
||||||
sum += 5 |
|
||||||
sum2 += 5 |
|
||||||
case "B Z": |
|
||||||
sum += 9 |
|
||||||
sum2 += 9 |
|
||||||
case "C X": |
|
||||||
sum += 7 |
|
||||||
sum2 += 2 |
|
||||||
case "C Y": |
|
||||||
sum += 2 |
|
||||||
sum2 += 6 |
|
||||||
case "C Z": |
|
||||||
sum += 6 |
|
||||||
sum2 += 7 |
|
||||||
print(sum) |
|
||||||
print(sum2) |
|
File diff suppressed because it is too large
Load Diff
@ -1,3 +0,0 @@ |
|||||||
A Y |
|
||||||
B X |
|
||||||
C Z |
|
@ -1,20 +0,0 @@ |
|||||||
lines = [i for i in open("input.txt", 'r').read().splitlines()] |
|
||||||
|
|
||||||
sum = 0 |
|
||||||
|
|
||||||
for l in lines: |
|
||||||
first = "" |
|
||||||
firstFound = False |
|
||||||
last = "" |
|
||||||
lastFound = False |
|
||||||
for i in range(len(l)): |
|
||||||
if not firstFound and l[i].isnumeric(): |
|
||||||
first = l[i] |
|
||||||
firstFound = True |
|
||||||
if not lastFound and l[-i-1].isnumeric(): |
|
||||||
last = l[-i-1] |
|
||||||
lastFound = True |
|
||||||
if firstFound and lastFound: |
|
||||||
continue |
|
||||||
sum += int(first + last) |
|
||||||
print(sum) |
|
@ -1,32 +0,0 @@ |
|||||||
lines = [i for i in open("input.txt", 'r').read().splitlines()] |
|
||||||
|
|
||||||
sum = 0 |
|
||||||
words = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"] |
|
||||||
|
|
||||||
for l in lines: |
|
||||||
first = "" |
|
||||||
firstFound = False |
|
||||||
last = "" |
|
||||||
lastFound = False |
|
||||||
n = len(l) |
|
||||||
for i in range(n): |
|
||||||
if not firstFound and l[i].isnumeric(): |
|
||||||
first = l[i] |
|
||||||
firstFound = True |
|
||||||
if not lastFound and l[-i-1].isnumeric(): |
|
||||||
last = l[-i-1] |
|
||||||
lastFound = True |
|
||||||
for j in range(len(words)): |
|
||||||
m = len(words[j]) |
|
||||||
if not firstFound and l[i:i+m] == words[j]: |
|
||||||
first = str(j) |
|
||||||
firstFound = True |
|
||||||
if not lastFound and l[-(i+m):n-i] == words[j]: |
|
||||||
last = str(j) |
|
||||||
lastFound = True |
|
||||||
if firstFound and lastFound: |
|
||||||
break |
|
||||||
s = first + last |
|
||||||
sum += int(s) |
|
||||||
|
|
||||||
print(sum) |
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +0,0 @@ |
|||||||
two1nine |
|
||||||
eightwothree |
|
||||||
abcone2threexyz |
|
||||||
xtwone3four |
|
||||||
4nineeightseven2 |
|
||||||
zoneight234 |
|
||||||
7pqrstsixteen |
|
Loading…
Reference in new issue