scripts/ege/11_Основная волна. Первый день/Файлы к заданиям-20230222T110948Z-001/Файлы к заданиям/13.py

28 lines
417 B
Python
Raw Normal View History

2023-05-05 00:45:01 +03:00
g = {
"а": "бг",
"б": "д",
"в": "абгд",
"г": "еж",
"д": "иле",
"е": "вл",
"ж": "е",
"и": "л",
"к": "ж",
"л": "жк",
}
def run(p, path):
if p == "е" and path:
return 1
ns = g[p]
r = 0
for n in ns:
if n not in path:
r += run(n, path + [n])
return r
print(run("е", []))