From 4bcdf724e57fb22decf167d881db902a209908b9 Mon Sep 17 00:00:00 2001 From: Zeheng Li Date: Thu, 28 Mar 2024 11:45:03 -0600 Subject: [PATCH] add examples --- src/conteststruggles.lua | 7 +++++ src/conteststruggles.py | 7 +++++ src/hnappasetningaskipti.py | 60 +++++++++++++++++++++++++++++++++++++ src/notamused.py | 22 ++++++++++++++ 4 files changed, 96 insertions(+) create mode 100644 src/conteststruggles.lua create mode 100644 src/conteststruggles.py create mode 100644 src/hnappasetningaskipti.py create mode 100644 src/notamused.py diff --git a/src/conteststruggles.lua b/src/conteststruggles.lua new file mode 100644 index 0000000..1e27db1 --- /dev/null +++ b/src/conteststruggles.lua @@ -0,0 +1,7 @@ +n, k, d, s = io.read("*n", "*n", "*n", "*n") +ans = (n * d - k * s) / (n - k) +if ans < 0 or ans > 100 then + print("impossible") +else + print(ans) +end diff --git a/src/conteststruggles.py b/src/conteststruggles.py new file mode 100644 index 0000000..6fd6950 --- /dev/null +++ b/src/conteststruggles.py @@ -0,0 +1,7 @@ +n, k = [int(c) for c in input().split()] +d, s = [int(c) for c in input().split()] +ans = (n * d - k * s) / (n - k) +if ans < 0 or ans > 100: + print("impossible") +else: + print(f"{ans:.7f}") diff --git a/src/hnappasetningaskipti.py b/src/hnappasetningaskipti.py new file mode 100644 index 0000000..769cc52 --- /dev/null +++ b/src/hnappasetningaskipti.py @@ -0,0 +1,60 @@ +table = """ +qwerty dvorak bjarki +~ ~ 0 +1 1 2 +2 2 4 +3 3 8 +4 4 6 +5 5 1 +6 6 3 +7 7 5 +8 8 7 +9 9 9 +0 0 = +- [ - += ] / +q ' b +w , j +e . a +r p r +t y k +y f i +u g g +i c u +o r s +p l t +[ / . +] = , +a a l +s o o +d e e +f u m +g i p +h d d +j h c +k t n +l n v +; s q +' - ; +z ; [ +x q ] +c j y +v k z +b x h +n b w +m m f +, w x +. v ' +/ z ~ +""".strip() + +m = { + "qwerty": [row.split("\t")[0] for row in table.split("\n")[1:]], + "dvorak": [row.split("\t")[1] for row in table.split("\n")[1:]], + "bjarki": [row.split("\t")[2] for row in table.split("\n")[1:]], +} +k, _, v = input().split() +mapping = dict(zip(m[k], m[v])) + +s = input() +print("".join(mapping.get(c, c) for c in s)) diff --git a/src/notamused.py b/src/notamused.py new file mode 100644 index 0000000..bfd5b67 --- /dev/null +++ b/src/notamused.py @@ -0,0 +1,22 @@ +from collections import Counter + +d = 1 +while True: + try: + s = input().split() + + if "OPEN" in s: + book = {} + t = Counter() + elif "ENTER" in s: + book[s[1]] = int(s[2]) + elif "EXIT" in s: + t[s[1]] += int(s[2]) - book.pop(s[1]) + elif "CLOSE" in s: + print(f"Day {d}") + for k in sorted(t): + print(f"{k} ${t[k]/10:.2f}") + print() + d += 1 + except: + break