diff options
| author | mhsn <mail@mhsn.net> | 2025-12-06 07:39:10 +0000 |
|---|---|---|
| committer | mhsn <mail@mhsn.net> | 2025-12-06 08:05:07 +0000 |
| commit | 4ccb030e234e34cb6a3fdc73f1158ab1b1a9020e (patch) | |
| tree | c9d5c2bbdd5bbad130f11a1123dd2d9d90914ccb | |
| parent | a91612ebd9b5994f3f3aa8fd54c8e5a54ebe4acf (diff) | |
| download | aoc-4ccb030e234e34cb6a3fdc73f1158ab1b1a9020e.tar.gz aoc-4ccb030e234e34cb6a3fdc73f1158ab1b1a9020e.zip | |
25-06 python p1
| -rwxr-xr-x | 2025/06/python.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/2025/06/python.py b/2025/06/python.py new file mode 100755 index 0000000..0f0aeb9 --- /dev/null +++ b/2025/06/python.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +from math import prod +from fileinput import input + +lines = [line.strip() for line in input()] +nums = [map(int, row.split()) for row in lines[:-1]] +fs = [prod if s == "*" else sum for s in lines[-1].split()] + + +silver = sum(f(ns) for f, ns in zip(fs, zip(*nums))) +gold = 0 + +print("silver:", silver) +print("gold:", gold) |
