-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path08-01.py
41 lines (40 loc) · 1.19 KB
/
08-01.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
trees = []
while True:
inputval = input()
if inputval == "": break
trees.append(inputval)
visible = []
count = 0
for row in trees:
visible.append([False] * len(row))
for i in range(len(trees)):
max_height = -1
for j in range(len(trees[0])):
if int(trees[i][j]) > max_height:
if not visible[i][j]:
count += 1
visible[i][j] = True
max_height = int(trees[i][j])
max_height = -1
for j in range(len(trees[0]) - 1, -1, -1):
if int(trees[i][j]) > max_height:
if not visible[i][j]:
count += 1
visible[i][j] = True
max_height = int(trees[i][j])
for j in range(len(trees[0])):
max_height = -1
for i in range(len(trees)):
if int(trees[i][j]) > max_height:
if not visible[i][j]:
count += 1
visible[i][j] = True
max_height = int(trees[i][j])
max_height = -1
for i in range(len(trees) - 1, -1, -1):
if int(trees[i][j]) > max_height:
if not visible[i][j]:
count += 1
visible[i][j] = True
max_height = int(trees[i][j])
print(count)