24 lines
430 B
Python
24 lines
430 B
Python
with open('input') as f:
|
|
data = [line.strip() for line in f]
|
|
|
|
width, height = (len(data[0], len(data))
|
|
|
|
slopes = ((1, 1),(3, 1),(5, 1),(7, 1),(1, 2))
|
|
|
|
result = 1
|
|
for slope in slopes:
|
|
trees = 0
|
|
right, down = slope
|
|
|
|
while(down < height):
|
|
if data[down][right%width] == '#':
|
|
trees += 1
|
|
right += slope[0]
|
|
down += slope[1]
|
|
|
|
result *= trees
|
|
print(slope, trees)
|
|
|
|
print(result)
|
|
|