mirror of
https://github.com/Alexander-D-Karpov/scripts.git
synced 2025-01-22 22:54:08 +03:00
31 lines
424 B
Python
Vendored
31 lines
424 B
Python
Vendored
g = {
|
|
"a": "cd",
|
|
"b": "ac",
|
|
"c": "gd",
|
|
"d": "he",
|
|
"e": "ab",
|
|
"f": "gbn",
|
|
"g": "ho",
|
|
"h": "jli",
|
|
"i": "fl",
|
|
"j": "kg",
|
|
"k": "h",
|
|
"l": "k",
|
|
"m": "fi",
|
|
"n": "mo",
|
|
"o": "f",
|
|
}
|
|
|
|
|
|
def f(p, path):
|
|
if p == "a" and path:
|
|
return 1
|
|
s = []
|
|
for n in g[p]:
|
|
if n not in path:
|
|
s.append(f(n, path + n))
|
|
return sum(s)
|
|
|
|
|
|
print(f("a", ""))
|