Pastehsjsjs

Untitled

Dec 11th, 2022
841
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.20 KB | None | 0 0
  1. from functools import lru_cache
  2.  
  3.  
  4. @lru_cache(None)
  5. def f(x, y):
  6.     if x == y:
  7.         return 1
  8.     if x > y or x == 3:
  9.         return 0
  10.     return   f(x + 1, y) + f(x*2, y)
  11. print(f(1, 40)) #154
  12.  
  13.  
Advertisement
Add Comment
Please, Sign In to add comment