Taddeus Kroes 1 سال پیش
والد
کامیت
3e57a679cf
2فایلهای تغییر یافته به همراه16 افزوده شده و 0 حذف شده
  1. 16 0
      2024/19_towels.py
  2. 0 0
      2024/input/19

+ 16 - 0
2024/19_towels.py

@@ -0,0 +1,16 @@
+#!/usr/bin/env python3
+import sys
+from functools import cache
+
+@cache
+def possible(design, towels):
+    if not design:
+        return 1
+    return sum(possible(design[len(towel):], towels)
+               for towel in towels if design.startswith(towel))
+
+towels = tuple(sys.stdin.readline().rstrip().split(', '))
+designs = sys.stdin.read().split()
+pos = [possible(design, towels) for design in designs]
+print(sum(map(bool, pos)))
+print(sum(pos))

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
2024/input/19


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است