Ledger Nano X - The secure hardware wallet
SHARE
TWEET

59

a guest Apr 8th, 2020 123 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n, m = map(int, input().split())
  2. a = []
  3. for i in range(n): a.append(list([-1 for j in range(m)]))
  4. a[0][0] = 1
  5. def sol(i, j):
  6.     if i >= 0 and j >= 0 and i < n and j < m:
  7.         if a[i][j] == -1: a[i][j] = sol(i-2, j-1)+sol(i-2, j+1)+sol(i-1, j-2)+sol(i+1, j-2)
  8.     else: return 0
  9.     return a[i][j]
  10. print(sol(n-1, m-1))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top