From 0849c2a1e29a105801262125f5c18cc5fd85c516 Mon Sep 17 00:00:00 2001 From: setop Date: Thu, 9 Dec 2021 23:55:58 +0100 Subject: [PATCH] day 9 --- d09/d09_1.py | 25 +++++++++++++ d09/d09_2.py | 38 +++++++++++++++++++ d09/input | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++ d09/sample | 5 +++ d09/tohtml.py | 18 +++++++++ 5 files changed, 186 insertions(+) create mode 100644 d09/d09_1.py create mode 100644 d09/d09_2.py create mode 100644 d09/input create mode 100644 d09/sample create mode 100644 d09/tohtml.py diff --git a/d09/d09_1.py b/d09/d09_1.py new file mode 100644 index 0000000..832894f --- /dev/null +++ b/d09/d09_1.py @@ -0,0 +1,25 @@ +import sys +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 + + + +""") +import sys +for l in sys.stdin.read().splitlines(): + for c in l: + #print('    '%(c), end='') + print(' %s '%(c,c), end='') + print('
') +print(""" +""")