scripts/ege/Апробация 10.03.2023/16.py

10 lines
158 B
Python
Raw Normal View History

2023-05-05 00:45:01 +03:00
def f(n):
if n < 3:
return 2
if n % 2 == 0:
return f(n - 2) - f(n - 1) + 2
return f(n - 1) - f(n - 2) - 2
print(f(29))