Advertisement
a_yadvichuk

binpoisk.py

Apr 10th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. height = [int(x) for x in input().split()]
  2. p_height = int(input())
  3. left = -1
  4. right = len(height)
  5. while right - left > 1:
  6.     middle = (left + right) // 2
  7.     if height[middle] >= p_height:
  8.         left = middle
  9.     else:
  10.         right = middle
  11. print(left + 2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement