From 8a37bebf27d7f3fe789ce56b83520a83c2c71428 Mon Sep 17 00:00:00 2001 From: Zeheng Li Date: Mon, 26 Aug 2024 21:12:16 -0600 Subject: [PATCH] add example --- src/haypoints.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/haypoints.py diff --git a/src/haypoints.py b/src/haypoints.py new file mode 100644 index 0000000..9268287 --- /dev/null +++ b/src/haypoints.py @@ -0,0 +1,14 @@ +m, n = [int(d) for d in input().split()] +h = {} +for _ in range(m): + k, v = input().split() + h[k] = int(v) +for _ in range(n): + res = 0 + while True: + s = input() + if s == ".": + break + w = s.split() + res += sum(h.get(k, 0) for k in w) + print(res)