Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class UserList(list):
- def __getitem__(self, item):
- if item < 0 or item > len(self):
- return 0
- return super(UserList, self).__getitem__(item)
- m, n = map(int, input().split())
- a = [UserList([0] * 8) for h in range(8)]
- a[n - 1][m - 1] = 1
- for i in range(n, 8):
- for j in range(8):
- if 0 < j < 7:
- a[i][j] = a[i - 1][j - 1] + a[i - 1][j + 1]
- print(sum(a[-1]))
Advertisement
Add Comment
Please, Sign In to add comment