parent
9df970d28b
commit
1ba863a06f
1 changed files with 21 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) |
Loading…
Reference in new issue