From 0e2bc53a03676b670b2dc3e21469e7ba3a057f29 Mon Sep 17 00:00:00 2001 From: Zeheng Li Date: Thu, 19 Sep 2024 02:57:17 -0600 Subject: [PATCH] add example --- src/fizzbuzz2.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/fizzbuzz2.py diff --git a/src/fizzbuzz2.py b/src/fizzbuzz2.py new file mode 100644 index 00000000..890b503b --- /dev/null +++ b/src/fizzbuzz2.py @@ -0,0 +1,17 @@ +n, m = [int(d) for d in input().split()] + +c = [] +for d in range(1, m + 1): + if d % 3 and d % 5: + c.append(str(d)) + elif not d % 3 and d % 5: + c.append("fizz") + elif d % 3 and not d % 5: + c.append("buzz") + else: + c.append("fizzbuzz") + +l = [] +for _ in range(n): + l.append(sum(a == b for a, b in zip(input().split(), c))) +print(l.index(max(l)) + 1)