day 12
This commit is contained in:
parent
e086476976
commit
346b97df52
3 changed files with 1118 additions and 0 deletions
24
day12/1bad.py
Normal file
24
day12/1bad.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import numpy as np
|
||||
|
||||
with open(r'day12/input.txt', 'r') as input:
|
||||
lines = input.read().split('\n')[:-1]
|
||||
tiles = []
|
||||
areas = []
|
||||
|
||||
i = -1
|
||||
for line in lines:
|
||||
if 'x' in line:
|
||||
dim,reqs = line.split(':')
|
||||
dim = list(map(int,dim.split('x')))
|
||||
reqs = list(map(int,reqs.strip().split(' ')))
|
||||
areas.append((dim,reqs))
|
||||
elif ':' in line:
|
||||
i+=1
|
||||
tiles.append([])
|
||||
elif line != '':
|
||||
tiles[i].append(list(map(lambda x: 1 if x=='#' else 0,list(line))))
|
||||
|
||||
count = 0
|
||||
for dim,reqs in areas:
|
||||
count += 1 if dim[0]*dim[1] >= sum(reqs)*9 else 0
|
||||
print(count)
|
||||
Loading…
Add table
Add a link
Reference in a new issue