scripts/ege/28.03.2023 ПРОБНИК/Faily_IN11_28032023_/13.py

28 lines
443 B
Python
Raw Normal View History

2023-05-05 00:45:01 +03:00
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("ж", []))