We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a9adb22 commit 6c51825Copy full SHA for 6c51825
1 file changed
live12/test121/문제2/백한결.py
@@ -8,6 +8,26 @@ def main():
8
9
result = 0
10
11
+ for i in range(N):
12
+ visible = 0
13
+
14
+ minSlope = float('inf')
15
+ for j in range(i-1, -1, -1):
16
+ slope = (heights[i] - heights[j]) / (i - j)
17
+ if slope < minSlope:
18
+ minSlope = slope
19
+ visible += 1
20
21
+ maxSlope = -float('inf')
22
+ for j in range(i+1, N):
23
+ slope = (heights[j] - heights[i]) / (j - i)
24
+ if slope > maxSlope:
25
+ maxSlope = slope
26
27
28
+ result = max(result, visible)
29
30
+ print(result)
31
32
if __name__ == '__main__':
33
main()
0 commit comments