parent
7ced6f10a7
commit
1d668e3192
2 changed files with 26 additions and 0 deletions
@ -0,0 +1,21 @@ |
|||||||
|
lines = [ [int(j) for j in list(i)] for i in open("input.txt", 'r').read().splitlines()] |
||||||
|
|
||||||
|
summa = 0 |
||||||
|
lowList = [] |
||||||
|
for x in range(len(lines)): |
||||||
|
for y in range(len(lines[x])): |
||||||
|
v = lines[x][y] |
||||||
|
l = 9 if x == 0 else lines[x-1][y] |
||||||
|
r = 9 if x == len(lines)-1 else lines[x+1][y] |
||||||
|
u = 9 if y == 0 else lines[x][y-1] |
||||||
|
d = 9 if y == len(lines[x])-1 else lines[x][y+1] |
||||||
|
if v < l and v < r and v < u and v < d: |
||||||
|
summa += 1 + v |
||||||
|
lowList.append((x,y)) |
||||||
|
|
||||||
|
for p in lowList: |
||||||
|
size = 0 |
||||||
|
|
||||||
|
|
||||||
|
print(summa) |
||||||
|
print(lowList) |
@ -0,0 +1,5 @@ |
|||||||
|
2199943210 |
||||||
|
3987894921 |
||||||
|
9856789892 |
||||||
|
8767896789 |
||||||
|
9899965678 |
Loading…
Reference in new issue