Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- price = input()
- price.split(' ')
- p= list()
- n = 0
- while n < len(price) :
- if price[n] == ' ' :
- n=n+1
- continue
- p.append(price[n])
- n = n+1
- p.sort()
- print(p)
- coins = input()
- def khoj(list,coin):
- first = 0
- last = len(list)
- found = False
- while found is False:
- mid = int((first+last)//2)
- if list[mid] == coin:
- found = True
- print(mid)
- elif list[mid+1] > coin > list[mid] :
- found = True
- print(mid)
- else :
- if coin > list[mid] :
- first = mid
- else :
- last = mid
- khoj(price,coins)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement