From edd0059e7eaf987a18ba8b2319b25e284cbe3ff1 Mon Sep 17 00:00:00 2001 From: setop Date: Fri, 10 Dec 2021 01:10:15 +0100 Subject: [PATCH] day 9 short --- d09/d09_1.py | 16 +--------------- d09/d09_2.py | 35 +++++++++++------------------------ d09/topgm.py | 7 +++++++ 3 files changed, 19 insertions(+), 39 deletions(-) create mode 100644 d09/topgm.py diff --git a/d09/d09_1.py b/d09/d09_1.py index 832894f..7184226 100644 --- a/d09/d09_1.py +++ b/d09/d09_1.py @@ -3,23 +3,9 @@ L = list(map(lambda s: [9]+list(map(int, s))+[9] ,sys.stdin.read().splitlines()) W = len(L[0]) L = [[9]*W] + L + [[9]*W] H = len(L) - -def printgrid(): - for row in L: - print("".join(map(str,row))) - -printgrid() S = 0 for x in range(1,H-1): for y in range(1,W-1): p = L[x][y] - n = L[x-1][y] - s = L[x+1][y] - e = L[x][y-1] - w = L[x][y+1] - islow =all([p