PnnK

task 23 py

Oct 10th, 2021
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. def f(start_pos, current_pos):
  2.     if start_pos == current_pos:
  3.         return 1
  4.     if start_pos > current_pos:
  5.         return 0
  6.     k = f(start_pos, current_pos-1)
  7.     k += f(start_pos, current_pos-2)
  8.     if current_pos % 2 == 0:
  9.         k += f(start_pos, current_pos//2)
  10.     return k
  11.  
  12.  
  13. print(f(3, 10)*f(10, 12))
  14.  
Advertisement
Add Comment
Please, Sign In to add comment