Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def it(y, x):
- posx, posy = 0, 0
- while posy < 323:
- yield posx % 31, posy
- posy += y
- posx += x
- file = open('input.txt')
- lines = list(map(list, file.readlines()))
- for i in range(len(lines)):
- lines[i] = lines[i][:-1]
- L = [[1,1], [1,3], [1,5], [1,7], [2, 1]]
- trees = [0] * 5
- position = [[0, 0]] * 5
- for i in range(5):
- for posx, posy in it(*L[i]):
- trees[i] += ("#" == lines[posy][posx])
- print(trees, trees[0]*trees[1]*trees[2]*trees[3]*trees[4])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement