mirror of
https://github.com/Alexander-D-Karpov/scripts.git
synced 2024-11-28 06:13:43 +03:00
28 lines
443 B
Python
28 lines
443 B
Python
g = {
|
||
"а": "б",
|
||
"б": "ве",
|
||
"в": "ги",
|
||
"г": "и",
|
||
"д": "абе",
|
||
"е": "вжл",
|
||
"ж": "вл",
|
||
"и": "нм",
|
||
"к": "д",
|
||
"л": "дк",
|
||
"м": "жл",
|
||
"н": "м",
|
||
}
|
||
|
||
|
||
def f(n, path):
|
||
if n == "е":
|
||
return 1
|
||
s = []
|
||
for nd in g[n]:
|
||
if path.count(nd) != 1:
|
||
s.append(f(nd, path + [nd]))
|
||
return sum(s)
|
||
|
||
|
||
print(f("ж", []))
|