mirror of
https://github.com/Alexander-D-Karpov/scripts.git
synced 2024-11-25 13:03:44 +03:00
20 lines
351 B
Python
Vendored
20 lines
351 B
Python
Vendored
def f(n, prev):
|
|
if n == 24:
|
|
return 1
|
|
if n > 24:
|
|
return 0
|
|
|
|
s = 0
|
|
if prev not in "12":
|
|
s += f(n + 1, "1")
|
|
if prev not in "12":
|
|
s += f(n + 2, "2")
|
|
if prev not in "34":
|
|
s += f(n * 2, "3")
|
|
if prev not in "34":
|
|
s += f(n * 3, "4")
|
|
return s
|
|
|
|
|
|
print(f(1, "0"))
|