Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- sys.setrecursionlimit(900000000)
- file_e = open('file.txt','r')
- file = file_e.readlines()
- file_e.close()
- file.reverse()
- for index,line in enumerate(file):
- file[index] = line.split(' ')
- print(len(file)-1, len(file[0])-1)
- def end(file,y,x):
- if y == len(file)-1 and x == len(file[0])-1: return 1
- try:
- if file[y+1][x] == '0': up = True
- except: pass
- try:
- if file[y][x+1] == '0': right = True
- except: pass
- try:
- if up == True and right == True: return end(file,y+1,x) + end(file,y,x+1)
- except: pass
- try:
- if up == True: return end(file,y+1,x)
- except: pass
- try:
- if right == True: return end(file,y,x+1)
- except: pass
- if file[y+1][x] == '1' or file[y][x+1] == '1':
- return 0
- print(end(file,0,0))
Add Comment
Please, Sign In to add comment