Advertisement
Pastehsjsjs

Untitled

Jun 9th, 2023
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | Source Code | 0 0
  1. alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  2. def f(x, y, c):
  3. if x[-1] == y:return c == 5
  4. elif 'M' in x or c > 5:return 0
  5. else:return f(x + alp[alp.index(x[-1]) + 1], y, c + 1) + f(x + alp[alp.index(x[-1]) + 4], y, c + 1)
  6.  
  7. print(f('A', 'O', 0))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement