mirror of
https://github.com/Alexander-D-Karpov/scripts.git
synced 2024-11-22 20:06:33 +03:00
28 lines
417 B
Python
28 lines
417 B
Python
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("е", []))
|