mfgnik

Untitled

May 13th, 2020
1,332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. class UserList(list):
  2.     def __getitem__(self, item):
  3.         if item < 0 or item > len(self):
  4.             return 0
  5.         return super(UserList, self).__getitem__(item)
  6.  
  7.  
  8. m, n = map(int, input().split())
  9. a = [UserList([0] * 8) for h in range(8)]
  10. a[n - 1][m - 1] = 1
  11. for i in range(n, 8):
  12.     for j in range(8):
  13.         if 0 < j < 7:
  14.             a[i][j] = a[i - 1][j - 1] + a[i - 1][j + 1]
  15. print(sum(a[-1]))
Advertisement
Add Comment
Please, Sign In to add comment