Advertisement
nq1s788

16 номер с суммой

Oct 19th, 2024
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.23 KB | None | 0 0
  1. #https://inf-ege.sdamgia.ru/problem?id=58222
  2. def f(n):
  3.     if n < 3:
  4.         return 1
  5.     if n % 2 == 1:
  6.         return f(n - 1) + 3 * f(n - 2)
  7.     sm = 0
  8.     for i in range(1, n):
  9.         sm += f(i)
  10.     return sm
  11.  
  12.  
  13. print(f(28))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement