scripts/ege/28.03.2023 ПРОБНИК/Faily_IN11_28032023_/23.py
2023-05-05 00:45:01 +03:00

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"))