From fad0e790ec93eb4c9f4b993041000338e2d59996 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Fri, 12 Dec 2025 07:13:48 +0100 Subject: Merry Christmas? --- 2025/12/a.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to '2025/12/a.py') diff --git a/2025/12/a.py b/2025/12/a.py index 5fdb11b..cac2c38 100644 --- a/2025/12/a.py +++ b/2025/12/a.py @@ -1,6 +1,23 @@ +# Just estimate if the shape fit basd on the area. I feel like I am +# being pranked, this problem sucks. + import fileinput +def present_area(lines5): + return sum(l.count('#') for l in lines5) + +def region(line): + wh, n = line[:-1].split(': ') + wh = tuple(int(i) for i in wh.split('x')) + c = [int(i) for i in n.split(' ')] + return wh, c + +def fits(wh, c, areas): + return wh[0]*wh[1] >= sum(c[i] * areas[i] for i in range(6)) + with fileinput.input() as lines: - for line in lines: - ... + lines = list(lines) + areas = [present_area(lines[5*i:5*(i+1)]) for i in range(6)] + regions = [region(line) for line in lines[30:]] +print(sum(1 if fits(*region, areas) else 0 for region in regions)) -- cgit v1.3